<bundle>mvn:org.opendaylight.controller/shutdown-api/${project.version}</bundle>
<bundle>mvn:org.opendaylight.controller/shutdown-impl/${project.version}</bundle>
<bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
- <bundle>wrap:mvn:com.google.guava/guava/${guava.version}</bundle>
+ <bundle>mvn:com.google.guava/guava/${guava.version}</bundle>
<bundle>mvn:org.javassist/javassist/${javassist.version}</bundle>
</feature>
<feature name='odl-config-manager' version='${project.version}'>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>commons.opendaylight</artifactId>
+ <version>1.4.2-SNAPSHOT</version>
+ <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+ </parent>
+ <artifactId>features-nsf</artifactId>
+ <packaging>pom</packaging>
+ <name>OpenDaylight :: Features :: Network Service Functions</name>
+ <description>Feature for Network Service Functions</description>
+ <properties>
+ <features.file>features.xml</features.file>
+ </properties>
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<features name="nsf-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+ <feature name="odl-nsf-all" description="OpenDaylight :: NSF :: All Network Service Functions" version="${project.version}">
+ <feature version="${sal.version}">odl-adsal-all</feature>
+ <feature version="${project.version}">odl-nsf-managers</feature>
+ <feature version="${project.version}">odl-adsal-northbound</feature>
+ <!--
+ TODO : Resolve this in a follow-up commit
+ <feature>odl-controller-web</feature>
+ -->
+ </feature>
+
+ <feature name="odl-nsf-managers" description="OpenDaylight :: AD-SAL :: Network Service Functions" version="${project.version}">
+ <feature version="${project.version}">base-all</feature>
+ <feature version="${sal.version}">odl-adsal-all</feature>
+ <bundle>mvn:org.opendaylight.controller/usermanager/${usermanager.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/usermanager.implementation/${usermanager.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/appauth/${appauth.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/connectionmanager/${connectionmanager.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/connectionmanager.implementation/${connectionmanager.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/containermanager/${containermanager.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/containermanager.implementation/${containermanager.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/statisticsmanager/${statisticsmanager.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/statisticsmanager.implementation/${statisticsmanager.implementation.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/switchmanager/${switchmanager.api.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/switchmanager.implementation/${switchmanager.implementation.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/forwardingrulesmanager/${forwardingrulesmanager.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/forwardingrulesmanager.implementation/${forwardingrulesmanager.implementation.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/topologymanager/${topologymanager.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/networkconfig.neutron/${networkconfig.neutron.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.implementation/${networkconfig.neutron.implementation.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/hosttracker/${hosttracker.api.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/hosttracker.implementation/${hosttracker.implementation.version}</bundle>
+
+ <bundle>mvn:org.opendaylight.controller/forwarding.staticrouting</bundle>
+
+ <bundle>mvn:org.opendaylight.controller.thirdparty/net.sf.jung2/2.0.1</bundle>
+ <bundle>mvn:org.opendaylight.controller/routing.dijkstra_implementation</bundle>
+ </feature>
+
+ <feature name="odl-adsal-northbound" description="OpenDaylight :: AD-SAL :: Northbound APIs" version="${project.version}">
+ <feature version="${project.version}">base-all</feature>
+ <feature version="${project.version}">odl-nsf-managers</feature>
+ <bundle start-level="35">mvn:org.ow2.asm/asm-all/${asm.version}</bundle>
+ <!--
+ TODO : Resolve these in a follow-up commit
+ <bundle>mvn:org.opendaylight.controller/httpservice-bridge/${httpservice-bridge.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/jolokia-bridge/${jolokia-bridge.version}</bundle>
+ -->
+ <bundle>mvn:org.opendaylight.controller/bundlescanner/${bundlescanner.api.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/bundlescanner.implementation/${bundlescanner.implementation.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/commons.northbound/${northbound.commons.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/flowprogrammer.northbound/${flowprogrammer.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/hosttracker.northbound/${hosttracker.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/networkconfig.bridgedomain.northbound/${networkconfig.bridgedomain.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.northbound/${networkconfig.neutron.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/forwarding.staticrouting.northbound/${forwarding.staticrouting.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/statistics.northbound/${statistics.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/subnets.northbound/${subnets.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/switchmanager.northbound/${switchmanager.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/topology.northbound/${topology.northbound.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller/usermanager.northbound/${usermanager.northbound.version}</bundle>
+ </feature>
+</features>
\ No newline at end of file
<maven>3.0</maven>
</prerequisites>
<modules>
+ <module>base</module>
+ <module>controller</module>
+ <module>adsal</module>
+ <module>nsf</module>
+ <module>extras</module>
<module>config</module>
<module>config-persister</module>
<module>config-netty</module>
<artifactId>sal-rest-connector</artifactId>
<version>${mdsal.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-rest-connector-config</artifactId>
+ <version>${mdsal.version}</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-rest-docgen</artifactId>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<sourceDirectory>${project.basedir}</sourceDirectory>
<includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</includes>
- <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/xtend-gen\/</excludes>
+ <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/xtend-gen\/,**\/protobuff\/</excludes>
</configuration>
<dependencies>
<dependency>
@Override
protected void customValidation(){
- JmxAttributeValidationException.checkNotNull(getTimeout(), "value is not set.", timeoutJmxAttribute);
- JmxAttributeValidationException.checkCondition(getTimeout() >= 0, "value " + getTimeout() + " is less than 0",
- timeoutJmxAttribute);
+ JmxAttributeValidationException.checkNotNull(getReconnectTimeout(), "value is not set.", reconnectTimeoutJmxAttribute);
+ JmxAttributeValidationException.checkCondition(getReconnectTimeout() >= 0, "value " + getReconnectTimeout() + " is less than 0",
+ reconnectTimeoutJmxAttribute);
}
@Override
public java.lang.AutoCloseable createInstance() {
- return new ReconnectImmediatelyStrategyFactoryCloseable(getExecutorDependency(), getTimeout());
+ return new ReconnectImmediatelyStrategyFactoryCloseable(getReconnectExecutorDependency(), getReconnectTimeout());
}
private static final class ReconnectImmediatelyStrategyFactoryCloseable implements ReconnectStrategyFactory, AutoCloseable {
@Override
public java.lang.AutoCloseable createInstance() {
- return new TimedReconnectStrategyFactoryCloseable(getExecutorDependency(),
+ return new TimedReconnectStrategyFactoryCloseable(getTimedReconnectExecutorDependency(),
getConnectTime(), getMinSleep(), getSleepFactor().doubleValue(), getMaxSleep(), getMaxAttempts(),
getDeadline());
}
case reconnect-immediately-strategy-factory {
when "/config:modules/config:module/config:type = 'reconnect-immediately-strategy-factory'";
- leaf timeout {
+ leaf reconnect-timeout {
mandatory true;
type int32;
}
- container executor {
+ container reconnect-executor {
uses config:service-ref {
refine type {
mandatory true;
units "milliseconds";
}
- container executor {
+ container timed-reconnect-executor {
uses config:service-ref {
refine type {
mandatory true;
final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(
transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME),
ReconnectImmediatelyStrategyFactoryModuleMXBean.class);
- mxBean.setTimeout(200);
+ mxBean.setReconnectTimeout(200);
final CommitStatus status = transaction.commit();
assertBeanCount(1, FACTORY_NAME);
assertStatus(status, 0, 1, 1);
final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
ReconnectImmediatelyStrategyFactoryModuleMXBean.class);
- mxBean.setTimeout(timeout);
- mxBean.setExecutor(GlobalEventExecutorUtil.create(transaction));
+ mxBean.setReconnectTimeout(timeout);
+ mxBean.setReconnectExecutor(GlobalEventExecutorUtil.create(transaction));
return nameCreated;
}
*/
package org.opendaylight.controller.config.yang.protocol.framework;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.math.BigDecimal;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.ObjectName;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.ConflictingVersionException;
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
import org.opendaylight.controller.config.yang.netty.eventexecutor.GlobalEventExecutorModuleFactory;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.ObjectName;
-import java.math.BigDecimal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
public class TimedReconnectStrategyModuleTest extends AbstractConfigTest {
private static final String INSTANCE_NAME = "timed-reconect-stategy-facotry-impl";
mxBean.setMaxSleep(maxSleep);
mxBean.setMinSleep(minSleep);
mxBean.setSleepFactor(sleepFactor);
- mxBean.setExecutor(GlobalEventExecutorUtil.create(transaction));
+ mxBean.setTimedReconnectExecutor(GlobalEventExecutorUtil.create(transaction));
return nameCreated;
}
*/
package org.opendaylight.controller.config.yangjmxgenerator.plugin;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.io.Files;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.io.FileUtils;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-
//TODO: refactor
public class JMXGeneratorTest extends AbstractGeneratorTest {
File generatedResourcesDir;
private static final List<String> expectedModuleFileNames = ServiceInterfaceEntryTest
- .toFileNames("[AbstractAsyncEventBusModule.java, AbstractAsyncEventBusModuleFactory.java, AbstractDynamicThreadPoolModule.java, AbstractDynamicThreadPoolModuleFactory.java, AbstractEventBusModule.java, AbstractEventBusModuleFactory.java, AbstractNamingThreadFactoryModule.java, AbstractNamingThreadFactoryModuleFactory.java, AbstractThreadPoolRegistryImplModule.java, AbstractThreadPoolRegistryImplModuleFactory.java, AsyncEventBusModule.java, AsyncEventBusModuleFactory.java, AsyncEventBusModuleMXBean.java, AsyncEventBusRuntimeMXBean.java, AsyncEventBusRuntimeRegistration.java, AsyncEventBusRuntimeRegistrator.java, DynamicThreadPoolModule.java, DynamicThreadPoolModuleFactory.java, DynamicThreadPoolModuleMXBean.java, DynamicThreadPoolRuntimeMXBean.java, DynamicThreadPoolRuntimeRegistration.java, DynamicThreadPoolRuntimeRegistrator.java, EventBusModule.java, EventBusModuleFactory.java, EventBusModuleMXBean.java, EventRuntimeMXBean.java, EventRuntimeRegistration.java, InnerStreamList.java, NamingThreadFactoryModule.java, NamingThreadFactoryModuleFactory.java, NamingThreadFactoryModuleMXBean.java, NamingThreadFactoryRuntimeMXBean.java, NamingThreadFactoryRuntimeRegistration.java, NamingThreadFactoryRuntimeRegistrator.java, Peer.java, StreamRuntimeMXBean.java, StreamRuntimeRegistration.java, ThreadPoolRegistryImplModule.java, ThreadPoolRegistryImplModuleFactory.java, ThreadPoolRegistryImplModuleMXBean.java, ThreadRuntimeMXBean.java, ThreadRuntimeRegistration.java, ThreadStreamRuntimeMXBean.java, ThreadStreamRuntimeRegistration.java]");
+ .toFileNames("[AbstractAsyncEventBusModule.java, AbstractAsyncEventBusModuleFactory.java, AbstractDynamicThreadPoolModule.java, AbstractDynamicThreadPoolModuleFactory.java, AbstractEventBusModule.java, AbstractEventBusModuleFactory.java, AbstractNamingThreadFactoryModule.java, AbstractNamingThreadFactoryModuleFactory.java, AbstractThreadPoolRegistryImplModule.java, AbstractThreadPoolRegistryImplModuleFactory.java, AsyncEventBusModule.java, AsyncEventBusModuleFactory.java, AsyncEventBusModuleMXBean.java, AsyncEventBusRuntimeMXBean.java, AsyncEventBusRuntimeRegistration.java, AsyncEventBusRuntimeRegistrator.java, DynamicThreadPoolModule.java, DynamicThreadPoolModuleFactory.java, DynamicThreadPoolModuleMXBean.java, DynamicThreadPoolRuntimeMXBean.java, DynamicThreadPoolRuntimeRegistration.java, DynamicThreadPoolRuntimeRegistrator.java, EventBusModule.java, EventBusModuleFactory.java, EventBusModuleMXBean.java, EventRuntimeMXBean.java, EventRuntimeRegistration.java, FromGrouping.java, InnerStreamList.java, NamingThreadFactoryModule.java, NamingThreadFactoryModuleFactory.java, NamingThreadFactoryModuleMXBean.java, NamingThreadFactoryRuntimeMXBean.java, NamingThreadFactoryRuntimeRegistration.java, NamingThreadFactoryRuntimeRegistrator.java, Peer.java, StreamRuntimeMXBean.java, StreamRuntimeRegistration.java, ThreadPoolRegistryImplModule.java, ThreadPoolRegistryImplModuleFactory.java, ThreadPoolRegistryImplModuleMXBean.java, ThreadRuntimeMXBean.java, ThreadRuntimeRegistration.java, ThreadStreamRuntimeMXBean.java, ThreadStreamRuntimeRegistration.java]");
private static final List<String> expectedBGPNames = ServiceInterfaceEntryTest
.toFileNames("[AbstractBgpListenerImplModule.java, " + "AbstractBgpListenerImplModuleFactory.java, " +
"NetconfTestFiles1ImplModuleMXBean.java, NetconfTestFiles1ImplRuntimeMXBean.java, " +
"NetconfTestFiles1ImplRuntimeRegistration.java, NetconfTestFiles1ImplRuntimeRegistrator.java, TestFileImplModule.java, TestFileImplModuleFactory.java, TestFileImplModuleMXBean.java, TestFileImplRuntimeMXBean.java, TestFileImplRuntimeRegistration.java, TestFileImplRuntimeRegistrator.java, TestFiles1ImplModule.java, TestFiles1ImplModuleFactory.java, TestFiles1ImplModuleMXBean.java, TestFiles1ImplRuntimeMXBean.java, TestFiles1ImplRuntimeRegistration.java, TestFiles1ImplRuntimeRegistrator.java]");
private static final List<String> expectedAllFileNames = ServiceInterfaceEntryTest
- .toFileNames("[AbstractAsyncEventBusModule.java, AbstractAsyncEventBusModuleFactory.java, AbstractBgpListenerImplModule.java, AbstractBgpListenerImplModuleFactory.java, AbstractDynamicThreadPoolModule.java, AbstractDynamicThreadPoolModuleFactory.java, AbstractEventBusModule.java, AbstractEventBusModuleFactory.java, AbstractNamingThreadFactoryModule.java, AbstractNamingThreadFactoryModuleFactory.java, AbstractNetconfTestFileImplModule.java, AbstractNetconfTestFileImplModuleFactory.java, AbstractNetconfTestFiles1ImplModule.java, AbstractNetconfTestFiles1ImplModuleFactory.java, AbstractNetconfTestImplModule.java, AbstractNetconfTestImplModuleFactory.java, AbstractTestFileImplModule.java, AbstractTestFileImplModuleFactory.java, AbstractTestFiles1ImplModule.java, AbstractTestFiles1ImplModuleFactory.java, AbstractTestImplModule.java, AbstractTestImplModuleFactory.java, AbstractThreadPoolRegistryImplModule.java, AbstractThreadPoolRegistryImplModuleFactory.java, AsyncEventBusModule.java, AsyncEventBusModuleFactory.java, AsyncEventBusModuleMXBean.java, AsyncEventBusRuntimeMXBean.java, AsyncEventBusRuntimeRegistration.java, AsyncEventBusRuntimeRegistrator.java, AutoCloseableServiceInterface.java, BgpListenerImplModule.java, BgpListenerImplModuleFactory.java, BgpListenerImplModuleMXBean.java, BgpListenerImplRuntimeMXBean.java, BgpListenerImplRuntimeRegistration.java, BgpListenerImplRuntimeRegistrator.java, ComplexDtoBInner.java, ComplexList.java, Deep.java, DtoA.java, DtoA.java, DtoA.java, DtoA1.java, DtoAInner.java, DtoAInnerInner.java, DtoB.java, DtoC.java, DynamicThreadPoolModule.java, DynamicThreadPoolModuleFactory.java, DynamicThreadPoolModuleMXBean.java, DynamicThreadPoolRuntimeMXBean.java, DynamicThreadPoolRuntimeRegistration.java, DynamicThreadPoolRuntimeRegistrator.java, EventBusModule.java, EventBusModuleFactory.java, EventBusModuleMXBean.java, EventBusServiceInterface.java, EventRuntimeMXBean.java, EventRuntimeRegistration.java, InnerStreamList.java, NamingThreadFactoryModule.java, NamingThreadFactoryModuleFactory.java, NamingThreadFactoryModuleMXBean.java, NamingThreadFactoryRuntimeMXBean.java, NamingThreadFactoryRuntimeRegistration.java, NamingThreadFactoryRuntimeRegistrator.java, NetconfTestFileImplModule.java, NetconfTestFileImplModuleFactory.java, NetconfTestFileImplModuleMXBean.java, NetconfTestFileImplRuntimeMXBean.java, NetconfTestFileImplRuntimeRegistration.java, NetconfTestFileImplRuntimeRegistrator.java, NetconfTestFiles1ImplModule.java, NetconfTestFiles1ImplModuleFactory.java, NetconfTestFiles1ImplModuleMXBean.java, NetconfTestFiles1ImplRuntimeMXBean.java, NetconfTestFiles1ImplRuntimeRegistration.java, NetconfTestFiles1ImplRuntimeRegistrator.java, NetconfTestImplModule.java, NetconfTestImplModuleFactory.java, NetconfTestImplModuleMXBean.java, NetconfTestImplRuntimeMXBean.java, NetconfTestImplRuntimeRegistration.java, NetconfTestImplRuntimeRegistrator.java, Peer.java, Peer.java, PeersRuntimeMXBean.java, PeersRuntimeRegistration.java, ScheduledThreadPoolServiceInterface.java, SimpleList.java, StreamRuntimeMXBean.java, StreamRuntimeRegistration.java, TestFileImplModule.java, TestFileImplModuleFactory.java, TestFileImplModuleMXBean.java, TestFileImplRuntimeMXBean.java, TestFileImplRuntimeRegistration.java, TestFileImplRuntimeRegistrator.java, TestFiles1ImplModule.java, TestFiles1ImplModuleFactory.java, TestFiles1ImplModuleMXBean.java, TestFiles1ImplRuntimeMXBean.java, TestFiles1ImplRuntimeRegistration.java, TestFiles1ImplRuntimeRegistrator.java, TestImplModule.java, TestImplModuleFactory.java, TestImplModuleMXBean.java, TestImplRuntimeMXBean.java, TestImplRuntimeRegistration.java, TestImplRuntimeRegistrator.java, ThreadFactoryServiceInterface.java, ThreadPoolRegistryImplModule.java, ThreadPoolRegistryImplModuleFactory.java, ThreadPoolRegistryImplModuleMXBean.java, ThreadPoolServiceInterface.java, ThreadRuntimeMXBean.java, ThreadRuntimeRegistration.java, ThreadStreamRuntimeMXBean.java, ThreadStreamRuntimeRegistration.java]");
+ .toFileNames("[AbstractAsyncEventBusModule.java, AbstractAsyncEventBusModuleFactory.java, AbstractBgpListenerImplModule.java, AbstractBgpListenerImplModuleFactory.java, AbstractDynamicThreadPoolModule.java, AbstractDynamicThreadPoolModuleFactory.java, AbstractEventBusModule.java, AbstractEventBusModuleFactory.java, AbstractNamingThreadFactoryModule.java, AbstractNamingThreadFactoryModuleFactory.java, AbstractNetconfTestFileImplModule.java, AbstractNetconfTestFileImplModuleFactory.java, AbstractNetconfTestFiles1ImplModule.java, AbstractNetconfTestFiles1ImplModuleFactory.java, AbstractNetconfTestImplModule.java, AbstractNetconfTestImplModuleFactory.java, AbstractTestFileImplModule.java, AbstractTestFileImplModuleFactory.java, AbstractTestFiles1ImplModule.java, AbstractTestFiles1ImplModuleFactory.java, AbstractTestImplModule.java, AbstractTestImplModuleFactory.java, AbstractThreadPoolRegistryImplModule.java, AbstractThreadPoolRegistryImplModuleFactory.java, AsyncEventBusModule.java, AsyncEventBusModuleFactory.java, AsyncEventBusModuleMXBean.java, AsyncEventBusRuntimeMXBean.java, AsyncEventBusRuntimeRegistration.java, AsyncEventBusRuntimeRegistrator.java, AutoCloseableServiceInterface.java, BgpListenerImplModule.java, BgpListenerImplModuleFactory.java, BgpListenerImplModuleMXBean.java, BgpListenerImplRuntimeMXBean.java, BgpListenerImplRuntimeRegistration.java, BgpListenerImplRuntimeRegistrator.java, ComplexDtoBInner.java, ComplexList.java, Deep.java, DtoA.java, DtoA.java, DtoA.java, DtoA1.java, DtoAInner.java, DtoAInnerInner.java, DtoB.java, DtoC.java, DynamicThreadPoolModule.java, DynamicThreadPoolModuleFactory.java, DynamicThreadPoolModuleMXBean.java, DynamicThreadPoolRuntimeMXBean.java, DynamicThreadPoolRuntimeRegistration.java, DynamicThreadPoolRuntimeRegistrator.java, EventBusModule.java, EventBusModuleFactory.java, EventBusModuleMXBean.java, EventBusServiceInterface.java, EventRuntimeMXBean.java, EventRuntimeRegistration.java, FromGrouping.java, InnerStreamList.java, NamingThreadFactoryModule.java, NamingThreadFactoryModuleFactory.java, NamingThreadFactoryModuleMXBean.java, NamingThreadFactoryRuntimeMXBean.java, NamingThreadFactoryRuntimeRegistration.java, NamingThreadFactoryRuntimeRegistrator.java, NetconfTestFileImplModule.java, NetconfTestFileImplModuleFactory.java, NetconfTestFileImplModuleMXBean.java, NetconfTestFileImplRuntimeMXBean.java, NetconfTestFileImplRuntimeRegistration.java, NetconfTestFileImplRuntimeRegistrator.java, NetconfTestFiles1ImplModule.java, NetconfTestFiles1ImplModuleFactory.java, NetconfTestFiles1ImplModuleMXBean.java, NetconfTestFiles1ImplRuntimeMXBean.java, NetconfTestFiles1ImplRuntimeRegistration.java, NetconfTestFiles1ImplRuntimeRegistrator.java, NetconfTestImplModule.java, NetconfTestImplModuleFactory.java, NetconfTestImplModuleMXBean.java, NetconfTestImplRuntimeMXBean.java, NetconfTestImplRuntimeRegistration.java, NetconfTestImplRuntimeRegistrator.java, Peer.java, Peer.java, PeersRuntimeMXBean.java, PeersRuntimeRegistration.java, ScheduledThreadPoolServiceInterface.java, SimpleList.java, StreamRuntimeMXBean.java, StreamRuntimeRegistration.java, TestFileImplModule.java, TestFileImplModuleFactory.java, TestFileImplModuleMXBean.java, TestFileImplRuntimeMXBean.java, TestFileImplRuntimeRegistration.java, TestFileImplRuntimeRegistrator.java, TestFiles1ImplModule.java, TestFiles1ImplModuleFactory.java, TestFiles1ImplModuleMXBean.java, TestFiles1ImplRuntimeMXBean.java, TestFiles1ImplRuntimeRegistration.java, TestFiles1ImplRuntimeRegistrator.java, TestImplModule.java, TestImplModuleFactory.java, TestImplModuleMXBean.java, TestImplRuntimeMXBean.java, TestImplRuntimeRegistration.java, TestImplRuntimeRegistrator.java, ThreadFactoryServiceInterface.java, ThreadPoolRegistryImplModule.java, ThreadPoolRegistryImplModuleFactory.java, ThreadPoolRegistryImplModuleMXBean.java, ThreadPoolServiceInterface.java, ThreadRuntimeMXBean.java, ThreadRuntimeRegistration.java, ThreadStreamRuntimeMXBean.java, ThreadStreamRuntimeRegistration.java]");
private static final List<String> expectedGenerateMBEsListNames = ServiceInterfaceEntryTest
.toFileNames("[AbstractBgpListenerImplModule.java, AbstractBgpListenerImplModuleFactory.java, BgpListenerImplModule.java, BgpListenerImplModuleFactory.java, BgpListenerImplModuleMXBean.java, BgpListenerImplRuntimeMXBean.java, BgpListenerImplRuntimeRegistration.java, BgpListenerImplRuntimeRegistrator.java, PeersRuntimeMXBean.java, PeersRuntimeRegistration.java]");
+ ".threads.java", visitor.packageName);
assertEquals("AsyncEventBusModuleMXBean", visitor.type);
- assertEquals("Incorrenct number of generated methods", 2,
+ assertEquals("Incorrenct number of generated methods", 4,
visitor.methods.size());
+
}
private void assertAbstractDynamicThreadPoolModule(MbeASTVisitor visitor) {
import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDependenciesAttribute;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute;
import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.NameConflictException;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
private Optional<? extends AbstractDependencyAttribute> extractDependency(final DataNodeContainer dataNodeContainer,
final DataSchemaNode attrNode, final Module currentModule, final Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
final SchemaContext schemaContext) {
- if (dataNodeContainer.getUses().size() == 1 && getChildNodeSizeWithoutUses(dataNodeContainer) == 0) {
+ if (isDependencyContainer(dataNodeContainer)) {
// reference
UsesNode usesNode = dataNodeContainer.getUses().iterator().next();
checkState(usesNode.getRefines().size() == 1, "Unexpected 'refine' child node size of " + dataNodeContainer);
return Optional.absent();
}
+ private boolean isDependencyContainer(final DataNodeContainer dataNodeContainer) {
+ if(dataNodeContainer.getUses().size() != 1) {
+ return false;
+ }
+ UsesNode onlyUses = dataNodeContainer.getUses().iterator().next();
+ if(onlyUses.getGroupingPath().getLastComponent().equals(ServiceRef.QNAME) == false) {
+ return false;
+ }
+
+ return getChildNodeSizeWithoutUses(dataNodeContainer) == 0;
+ }
+
private int getChildNodeSizeWithoutUses(final DataNodeContainer csn) {
int result = 0;
for (DataSchemaNode dsn : csn.getChildNodes()) {
}
}
+ grouping async-eventbus-config-attrs {
+ leaf cfg-attr {
+ type string;
+ }
+ }
+
augment "/config:modules/config:module/config:configuration" {
case async-eventbus {
when "/config:modules/config:module/config:type = 'async-eventbus'";
}
}
}
+
+ container from-grouping {
+ uses async-eventbus-config-attrs;
+ }
}
}
augment "/config:modules/config:module/config:state" {
<type>xml</type>
<scope>runtime</scope>
</dependency>
+
+ <!-- AD-SAL Related Features -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-adsal</artifactId>
<type>xml</type>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-nsf</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- MD-SAL Related Features -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>mdsal-features</artifactId>
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>unpack-provided-configs</id>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ <configuration>
+ <outputDirectory>${project.build.directory}/configuration</outputDirectory>
+ <includeArtifactIds>sal-rest-connector-config</includeArtifactIds>
+ <includes>**\/*.xml</includes>
+ <excludeTransitive>true</excludeTransitive>
+ <ignorePermissions>false</ignorePermissions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-rest-connector</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-rest-connector-config</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-rest-docgen</artifactId>
</goals>
<phase>package</phase>
</execution>
+ <execution>
+ <id>unpack-provided-configs</id>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ <configuration>
+ <outputDirectory>${project.build.directory}/configuration</outputDirectory>
+ <includeArtifactIds>sal-rest-connector-config</includeArtifactIds>
+ <includes>**\/*.xml</includes>
+ <excludeTransitive>true</excludeTransitive>
+ <ignorePermissions>false</ignorePermissions>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
opendaylight/
</outputDirectory>
</fileSet>
+ <fileSet>
+ <directory>${project.build.directory}/configuration/initial</directory>
+ <outputDirectory>/opendaylight/configuration/initial</outputDirectory>
+ <excludes>
+ <exclude>**/META-INF/**</exclude>
+ </excludes>
+ </fileSet>
</fileSets>
<files>
<file>
</schema-service>
</module>
-->
- <!-- Cluster RPC -->
- <!-- Enable the following module if you want to use remote rpc connector
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">prefix:remote-rpc-connector</type>
- <name>remote-rpc-connector</name>
- <dom-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
- <name>dom-broker</name>
- </dom-broker>
- </module>
- -->
+
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-operational-datastore-provider</type>
<name>operational-store-service</name>
- <schema-service>
+ <operational-schema-service>
<type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
<name>yang-schema-service</name>
- </schema-service>
+ </operational-schema-service>
</module>
<!--
Tree-based in-memory data store. This is the data store which is currently
</binding-mapping-service>
</binding-forwarded-data-broker>
</module>
+ <!-- Cluster RPC -->
+ <!-- Enable the following module if you want to use remote rpc connector
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">prefix:remote-rpc-connector</type>
+ <name>remote-rpc-connector</name>
+ <dom-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
+ <name>dom-broker</name>
+ </dom-broker>
+ </module>
+ -->
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<service>
grouping flow-statistics {
container flow-statistics {
//config "false";
- uses flow-types:flow;
uses stat-types:generic-statistics;
}
}
<!-- Connectors -->
<module>sal-connector-api</module>
<module>sal-rest-connector</module>
+ <module>sal-rest-connector-config</module>
<module>sal-netconf-connector</module>
<module>inventory-manager</module>
<!-- Documentation -->
<module>sal-rest-docgen</module>
+ <module>sal-akka-raft</module>
+
<!--InMemory DOM DataStore-->
<module>sal-inmemory-datastore</module>
<!--sal-protocolbuffer-encoding-->
<module>sal-protocolbuffer-encoding</module>
+ <!-- sal-distributed-datastore -->
+ <module>sal-distributed-datastore</module>
+
+ <!-- XSQL -->
+ <module>sal-dom-xsql</module>
+
<!-- Yang Test Models for MD-SAL -->
<module>sal-test-model</module>
+
+ <!-- Clustering -->
+ <module>sal-remoterpc-connector</module>
</modules>
<build>
--- /dev/null
+Instructions on generating the protocol buffer Java source files
+
+These instructions are developers who are planning to generate the protocolbuffer java source files.
+
+1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box.
+The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on
+your OS.
+
+2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your
+machine
+
+3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source
+ get generation in proper packages. For more information check
+ https://developers.google.com/protocol-buffers/docs/javatutorial
+
+ For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated
+
+4. To generate the java source files execute in sal-protocolbuffer-encoding directory
+ just run.sh in sal-protocolbuffer-encoding or execute the following command
+
+ protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+
+5. Run mvn clean install & build the .jar
+
+6. !!!WARNING!!! - never edit the generated sources files of protocol buffer
+
+7. !!!NOTE!!! if you are planning to add new .proto file option java_package should begin with
+ org.opendaylight.controller.protobuff.messages to properly exclude from sonar.
<packaging>bundle</packaging>
<dependencies>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>2.5.0</version>
+ </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</execution>
</executions>
</plugin>
+
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <excludes>**/protobuff/**/*</excludes>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
<scm>
--- /dev/null
+#!/bin/bash
+
+#####################################################################################################
+#Instructions on generating the protocol buffer Java source files
+#
+#These instructions are developers who are planning to generate the protocolbuffer java source files.
+#
+#1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box.
+#The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on
+#your OS.
+#
+#2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your
+#machine
+#
+#3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source
+# get generation in proper packages. For more information check
+# https://developers.google.com/protocol-buffers/docs/javatutorial
+#
+# For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated
+#
+#4. To generate the java source files execute in sal-protocolbuffer-encoding execute ./run.sh i.e. this script
+# or run command
+# protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+#
+#5. Run mvn clean install & build the .jar
+#
+#6 !!!WARNING!!!! never edit the source files generated
+#
+#7. !!!NOTE!!! if you are planning to add new .proto file option java_package should begin with
+# org.opendaylight.controller.protobuff.messages to properly exclude from sonar.
+########################################################################################################
+
+protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+
+protoc --proto_path=src/main/resources --proto_path=src/test/resources --java_out=src/test/java src/test/resources/*.proto
+
+echo "Done generating Java source files."
+
+#to remove trailing spaces in the code files
+find src/main/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
+
+find src/test/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
import org.opendaylight.controller.cluster.example.messages.PrintRole;
import org.opendaylight.controller.cluster.example.messages.PrintState;
import org.opendaylight.controller.cluster.raft.RaftActor;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
import java.util.HashMap;
import java.util.Map;
@Override public void onReceiveCommand(Object message){
if(message instanceof KeyValue){
-
if(isLeader()) {
String persistId = Long.toString(persistIdentifier++);
- persistData(getSender(), persistId, message);
+ persistData(getSender(), persistId, (Payload) message);
} else {
if(getLeader() != null) {
getLeader().forward(message, getContext());
}
} else if (message instanceof PrintState) {
- LOG.debug("State of the node:"+getId() + " is="+state.size());
+ LOG.debug("State of the node:"+getId() + " has = "+state.size() + " entries");
} else if (message instanceof PrintRole) {
LOG.debug(getId() + " = " + getRaftState());
+ } else {
+ super.onReceiveCommand(message);
}
- super.onReceiveCommand(message);
}
@Override protected void applyState(ActorRef clientActor, String identifier,
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
-
+/**
+ * This is a test driver for testing akka-raft implementation
+ * Its uses ExampleActors and threads to push content(key-vals) to these actors
+ * Each ExampleActor can have one or more ClientActors. Each ClientActor spawns
+ * a thread and starts push logs to the actor its assignged to.
+ */
public class TestDriver {
private static final ActorSystem actorSystem = ActorSystem.create();
package org.opendaylight.controller.cluster.example.messages;
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+
import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class KeyValue extends Payload implements Serializable {
+ private String key;
+ private String value;
-public class KeyValue implements Serializable{
- private final String key;
- private final String value;
+ public KeyValue() {
+ }
public KeyValue(String key, String value){
this.key = key;
return value;
}
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
@Override public String toString() {
return "KeyValue{" +
"key='" + key + '\'' +
", value='" + value + '\'' +
'}';
}
+
+ // override this method to return the protobuff related extension fields and their values
+ @Override public Map<GeneratedMessage.GeneratedExtension, String> encode() {
+ Map<GeneratedMessage.GeneratedExtension, String> map = new HashMap<>();
+ map.put(KeyValueMessages.key, getKey());
+ map.put(KeyValueMessages.value, getValue());
+ return map;
+ }
+
+ // override this method to assign the values from protobuff
+ @Override public Payload decode(
+ AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payloadProtoBuff) {
+ String key = payloadProtoBuff.getExtension(KeyValueMessages.key);
+ String value = payloadProtoBuff.getExtension(KeyValueMessages.value);
+ this.setKey(key);
+ this.setValue(value);
+ return this;
+ }
+
}
package org.opendaylight.controller.cluster.example.messages;
-public class KeyValueSaved {
+import java.io.Serializable;
+
+public class KeyValueSaved implements Serializable {
}
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.controller.cluster.example.messages;
-/**
- * Created by kramesha on 7/17/14.
- */
-public class PrintRole {
+import java.io.Serializable;
+
+public class PrintRole implements Serializable {
}
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.controller.cluster.example.messages;
-/**
- * Created by kramesha on 7/17/14.
- */
-public class PrintState {
+import java.io.Serializable;
+
+public class PrintState implements Serializable {
}
--- /dev/null
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: KeyValueMessages.proto
+
+package org.opendaylight.controller.cluster.example.protobuff.messages;
+
+public final class KeyValueMessages {
+ private KeyValueMessages() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registry.add(org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages.key);
+ registry.add(org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages.value);
+ }
+ public static final int KEY_FIELD_NUMBER = 2;
+ /**
+ * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+ */
+ public static final
+ com.google.protobuf.GeneratedMessage.GeneratedExtension<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+ java.lang.String> key = com.google.protobuf.GeneratedMessage
+ .newFileScopedGeneratedExtension(
+ java.lang.String.class,
+ null);
+ public static final int VALUE_FIELD_NUMBER = 3;
+ /**
+ * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+ */
+ public static final
+ com.google.protobuf.GeneratedMessage.GeneratedExtension<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+ java.lang.String> value = com.google.protobuf.GeneratedMessage
+ .newFileScopedGeneratedExtension(
+ java.lang.String.class,
+ null);
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\026KeyValueMessages.proto\022(org.opendaylig" +
+ "ht.controller.cluster.raft\032\033AppendEntrie" +
+ "sMessages.proto:_\n\003key\022R.org.opendayligh" +
+ "t.controller.cluster.raft.AppendEntries." +
+ "ReplicatedLogEntry.Payload\030\002 \001(\t:a\n\005valu" +
+ "e\022R.org.opendaylight.controller.cluster." +
+ "raft.AppendEntries.ReplicatedLogEntry.Pa" +
+ "yload\030\003 \001(\tBT\n>org.opendaylight.controll" +
+ "er.cluster.example.protobuff.messagesB\020K" +
+ "eyValueMessagesH\001"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ key.internalInit(descriptor.getExtensions().get(0));
+ value.internalInit(descriptor.getExtensions().get(1));
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
import akka.persistence.SnapshotOffer;
import akka.persistence.SnapshotSelectionCriteria;
import akka.persistence.UntypedPersistentActor;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
+import org.opendaylight.controller.cluster.raft.base.messages.Replicate;
import org.opendaylight.controller.cluster.raft.behaviors.Candidate;
import org.opendaylight.controller.cluster.raft.behaviors.Follower;
import org.opendaylight.controller.cluster.raft.behaviors.Leader;
import org.opendaylight.controller.cluster.raft.client.messages.AddRaftPeer;
import org.opendaylight.controller.cluster.raft.client.messages.FindLeader;
import org.opendaylight.controller.cluster.raft.client.messages.FindLeaderReply;
-import org.opendaylight.controller.cluster.raft.internal.messages.ApplySnapshot;
import org.opendaylight.controller.cluster.raft.client.messages.RemoveRaftPeer;
-import org.opendaylight.controller.cluster.raft.internal.messages.ApplyState;
-import org.opendaylight.controller.cluster.raft.internal.messages.Replicate;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
import java.io.Serializable;
import java.util.ArrayList;
applyState(applyState.getClientActor(), applyState.getIdentifier(),
applyState.getReplicatedLogEntry().getData());
+
} else if(message instanceof ApplySnapshot ) {
applySnapshot(((ApplySnapshot) message).getSnapshot());
+
} else if (message instanceof FindLeader) {
getSender().tell(
new FindLeaderReply(
context.getPeerAddress(currentBehavior.getLeaderId())),
getSelf()
);
+
} else if (message instanceof SaveSnapshotSuccess) {
SaveSnapshotSuccess success = (SaveSnapshotSuccess) message;
} else if (message instanceof SaveSnapshotFailure) {
// TODO: Handle failure in saving the snapshot
- // Maybe do retries on failure
+
+ } else if (message instanceof FindLeader){
+
+ getSender().tell(new FindLeaderReply(
+ context.getPeerAddress(currentBehavior.getLeaderId())),
+ getSelf());
} else if (message instanceof AddRaftPeer){
* @param data
*/
protected void persistData(ActorRef clientActor, String identifier,
- Object data) {
+ Payload data) {
ReplicatedLogEntry replicatedLogEntry = new ReplicatedLogImplEntry(
context.getReplicatedLog().lastIndex() + 1,
return currentBehavior.state();
}
+ /**
+ * setPeerAddress sets the address of a known peer at a later time.
+ * <p>
+ * This is to account for situations where a we know that a peer
+ * exists but we do not know an address up-front. This may also be used in
+ * situations where a known peer starts off in a different location and we
+ * need to change it's address
+ * <p>
+ * Note that if the peerId does not match the list of peers passed to
+ * this actor during construction an IllegalStateException will be thrown.
+ *
+ * @param peerId
+ * @param peerAddress
+ */
+ protected void setPeerAddress(String peerId, String peerAddress){
+ context.setPeerAddress(peerId, peerAddress);
+ }
+
/**
final String identifier,
final ReplicatedLogEntry replicatedLogEntry) {
context.getLogger().debug(
- "Append log entry and persist " + replicatedLogEntry);
+ "Append log entry and persist {} ", replicatedLogEntry);
// FIXME : By adding the replicated log entry to the in-memory journal we are not truly ensuring durability of the logs
journal.add(replicatedLogEntry);
}
- private static class ReplicatedLogImplEntry implements ReplicatedLogEntry,
- Serializable {
-
- private final long index;
- private final long term;
- private final Object payload;
- public ReplicatedLogImplEntry(long index, long term, Object payload) {
-
- this.index = index;
- this.term = term;
- this.payload = payload;
- }
-
- @Override public Object getData() {
- return payload;
- }
-
- @Override public long getTerm() {
- return term;
- }
-
- @Override public long getIndex() {
- return index;
- }
-
- @Override public String toString() {
- return "Entry{" +
- "index=" + index +
- ", term=" + term +
- '}';
- }
- }
private static class DeleteEntries implements Serializable {
private final int fromIndex;
ActorSystem getActorSystem();
/**
+ * Get the logger to be used for logging messages
*
* @return
*/
LoggingAdapter getLogger();
/**
- * Get a mapping of peer id's their addresses
+ * Get a mapping of peerId's to their addresses
+ *
* @return
+ *
*/
Map<String, String> getPeerAddresses();
/**
+ * Get the address of the peer as a String. This is the same format in
+ * which a consumer would provide the address
*
* @param peerId
- * @return
+ * @return The address of the peer or null if the address has not yet been
+ * resolved
*/
String getPeerAddress(String peerId);
* @param name
*/
public void removePeer(String name);
+
+ /**
+ * Given a peerId return the corresponding actor
+ * <p>
+ *
+ *
+ * @param peerId
+ * @return The actorSelection corresponding to the peer or null if the
+ * address has not yet been resolved
+ */
+ ActorSelection getPeerActorSelection(String peerId);
+
+ /**
+ * Set Peer Address can be called at a later time to change the address of
+ * a known peer.
+ *
+ * <p>
+ * Throws an IllegalStateException if the peer is unknown
+ *
+ * @param peerId
+ * @param peerAddress
+ */
+ void setPeerAddress(String peerId, String peerAddress);
}
import java.util.Map;
+import static com.google.common.base.Preconditions.checkState;
+
public class RaftActorContextImpl implements RaftActorContext{
private final ActorRef actor;
private final LoggingAdapter LOG;
-
public RaftActorContextImpl(ActorRef actor, UntypedActorContext context,
String id,
ElectionTerm termInformation, long commitIndex,
}
@Override public void addToPeers(String name, String address) {
- LOG.debug("Kamal--> addToPeer for:"+name);
peerAddresses.put(name, address);
}
@Override public void removePeer(String name) {
- LOG.debug("Kamal--> removePeer for:"+name);
peerAddresses.remove(name);
}
+
+ @Override public ActorSelection getPeerActorSelection(String peerId) {
+ String peerAddress = getPeerAddress(peerId);
+ if(peerAddress != null){
+ return actorSelection(peerAddress);
+ }
+ return null;
+ }
+
+ @Override public void setPeerAddress(String peerId, String peerAddress) {
+ LOG.info("Peer address for peer {} set to {}", peerId, peerAddress);
+ checkState(peerAddresses.containsKey(peerId), peerId + " is unknown");
+
+ peerAddresses.put(peerId, peerAddress);
+ }
}
package org.opendaylight.controller.cluster.raft;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
/**
* Represents one entry in the replicated log
*/
*
* @return
*/
- Object getData();
+ Payload getData();
/**
* The term stored in that entry
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.raft;
+
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
+import java.io.Serializable;
+
+public class ReplicatedLogImplEntry implements ReplicatedLogEntry,
+ Serializable {
+
+ private final long index;
+ private final long term;
+ private final Payload payload;
+
+ public ReplicatedLogImplEntry(long index, long term, Payload payload) {
+
+ this.index = index;
+ this.term = term;
+ this.payload = payload;
+ }
+
+ @Override public Payload getData() {
+ return payload;
+ }
+
+ @Override public long getTerm() {
+ return term;
+ }
+
+ @Override public long getIndex() {
+ return index;
+ }
+
+ @Override public String toString() {
+ return "Entry{" +
+ "index=" + index +
+ ", term=" + term +
+ '}';
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.raft;
+
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+
+public class SerializationUtils {
+
+ public static Object fromSerializable(Object serializable){
+ if(serializable.getClass().equals(AppendEntries.SERIALIZABLE_CLASS)){
+ return AppendEntries.fromSerializable(serializable);
+ }
+ return serializable;
+ }
+
+}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.raft.base.messages;
-public class ApplySnapshot {
+import java.io.Serializable;
+
+public class ApplySnapshot implements Serializable {
private final Object snapshot;
public ApplySnapshot(Object snapshot) {
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.raft.base.messages;
import akka.actor.ActorRef;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
-public class ApplyState {
+import java.io.Serializable;
+
+public class ApplyState implements Serializable {
private final ActorRef clientActor;
private final String identifier;
private final ReplicatedLogEntry replicatedLogEntry;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.raft.base.messages;
+
+import java.io.Serializable;
/**
* Message sent to commit an entry to the log
*/
-public class CommitEntry {
+public class CommitEntry implements Serializable {
}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.raft.base.messages;
-public class SendInstallSnapshot {
+import java.io.Serializable;
+
+public class ElectionTimeout implements Serializable {
}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.raft.base.messages;
+
+import java.io.Serializable;
/**
* Message sent to Persist an entry into the transaction journal
*/
-public class PersistEntry {
+public class PersistEntry implements Serializable {
}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.raft.base.messages;
import akka.actor.ActorRef;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
-public class Replicate {
+import java.io.Serializable;
+
+public class Replicate implements Serializable {
private final ActorRef clientActor;
private final String identifier;
private final ReplicatedLogEntry replicatedLogEntry;
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.raft.base.messages;
+
+import java.io.Serializable;
/**
* This message is sent by a RaftActor to itself so that a subclass can process
* it and use it to save it's state
*/
-public class SaveSnapshot {
+public class SaveSnapshot implements Serializable {
}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.raft.base.messages;
+
+import java.io.Serializable;
/**
* This messages is sent to the Leader to prompt it to send a heartbeat
*
* Typically the Leader to itself on a schedule
*/
-public class SendHeartBeat {
+public class SendHeartBeat implements Serializable {
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.raft.base.messages;
+
+import java.io.Serializable;
+
+public class SendInstallSnapshot implements Serializable {
+}
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
-import org.opendaylight.controller.cluster.raft.internal.messages.ApplyState;
-import org.opendaylight.controller.cluster.raft.internal.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.SerializationUtils;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
import org.opendaylight.controller.cluster.raft.messages.RequestVote;
context.setLastApplied(index);
}
+ protected Object fromSerializableMessage(Object serializable){
+ return SerializationUtils.fromSerializable(serializable);
+ }
+
@Override
public RaftState handleMessage(ActorRef sender, Object message) {
if (message instanceof AppendEntries) {
import akka.actor.ActorSelection;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
-import org.opendaylight.controller.cluster.raft.internal.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
import org.opendaylight.controller.cluster.raft.messages.RaftRPC;
import org.opendaylight.controller.cluster.raft.messages.RequestVote;
import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.Set;
/**
* The behavior of a RaftActor when it is in the CandidateState
*/
public class Candidate extends AbstractRaftActorBehavior {
- private final Map<String, ActorSelection> peerToActor = new HashMap<>();
-
private int voteCount;
private final int votesRequired;
+ private final Set<String> peers;
+
public Candidate(RaftActorContext context) {
super(context);
- Collection<String> peerPaths = context.getPeerAddresses().values();
+ peers = context.getPeerAddresses().keySet();
- for (String peerPath : peerPaths) {
- peerToActor.put(peerPath,
- context.actorSelection(peerPath));
- }
+ context.getLogger().debug("Election:Candidate has following peers:"+ peers);
- context.getLogger().debug("Election:Candidate has following peers:"+peerToActor.keySet());
- if(peerPaths.size() > 0) {
+ if(peers.size() > 0) {
// Votes are required from a majority of the peers including self.
// The votesRequired field therefore stores a calculated value
// of the number of votes required for this candidate to win an
// 0 peers = 1 votesRequired (0 + 1) / 2 + 1 = 1
// 2 peers = 2 votesRequired (2 + 1) / 2 + 1 = 2
// 4 peers = 3 votesRequired (4 + 1) / 2 + 1 = 3
- int noOfPeers = peerPaths.size();
+ int noOfPeers = peers.size();
int self = 1;
votesRequired = (noOfPeers + self) / 2 + 1;
} else {
@Override protected RaftState handleAppendEntries(ActorRef sender,
AppendEntries appendEntries) {
+ context.getLogger().info("Candidate: Received {}", appendEntries.toString());
+
return state();
}
}
@Override
- public RaftState handleMessage(ActorRef sender, Object message) {
+ public RaftState handleMessage(ActorRef sender, Object originalMessage) {
+
+ Object message = fromSerializableMessage(originalMessage);
if (message instanceof RaftRPC) {
+
RaftRPC rpc = (RaftRPC) message;
+
+ context.getLogger().debug("RaftRPC message received {} my term is {}", rpc.toString(), context.getTermInformation().getCurrentTerm());
+
// If RPC request or response contains term T > currentTerm:
// set currentTerm = T, convert to follower (§5.1)
// This applies to all RPC messages and responses
scheduleElection(electionDuration());
return state();
}
+
return super.handleMessage(sender, message);
}
// Increment the election term and vote for self
long currentTerm = context.getTermInformation().getCurrentTerm();
- context.getTermInformation().updateAndPersist(currentTerm + 1, context.getId());
+ context.getTermInformation().updateAndPersist(currentTerm + 1,
+ context.getId());
- context.getLogger().debug("Starting new term " + (currentTerm+1));
+ context.getLogger().debug("Starting new term " + (currentTerm + 1));
// Request for a vote
// TODO: Retry request for vote if replies do not arrive in a reasonable
// amount of time TBD
- for (ActorSelection peerActor : peerToActor.values()) {
- peerActor.tell(new RequestVote(
- context.getTermInformation().getCurrentTerm(),
- context.getId(),
- context.getReplicatedLog().lastIndex(),
- context.getReplicatedLog().lastTerm()),
- context.getActor()
- );
+ for (String peerId : peers) {
+ ActorSelection peerActor = context.getPeerActorSelection(peerId);
+ if(peerActor != null) {
+ peerActor.tell(new RequestVote(
+ context.getTermInformation().getCurrentTerm(),
+ context.getId(),
+ context.getReplicatedLog().lastIndex(),
+ context.getReplicatedLog().lastTerm()),
+ context.getActor()
+ );
+ }
}
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
-import org.opendaylight.controller.cluster.raft.internal.messages.ApplySnapshot;
-import org.opendaylight.controller.cluster.raft.internal.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
import org.opendaylight.controller.cluster.raft.messages.InstallSnapshot;
@Override protected RaftState handleAppendEntries(ActorRef sender,
AppendEntries appendEntries) {
+ if(appendEntries.getEntries() != null && appendEntries.getEntries().size() > 0) {
+ context.getLogger()
+ .info("Follower: Received {}", appendEntries.toString());
+ }
+
// TODO : Refactor this method into a bunch of smaller methods
// to make it easier to read. Before refactoring ensure tests
// cover the code properly
for (int i = addEntriesFrom;
i < appendEntries.getEntries().size(); i++) {
- context.getLogger().debug(
- "Append entry to log " + appendEntries.getEntries().get(i).getData()
+ context.getLogger().info(
+ "Append entry to log " + appendEntries.getEntries().get(
+ i).getData()
.toString()
);
context.getReplicatedLog()
return RaftState.Follower;
}
- @Override public RaftState handleMessage(ActorRef sender, Object message) {
+ @Override public RaftState handleMessage(ActorRef sender, Object originalMessage) {
+
+ Object message = fromSerializableMessage(originalMessage);
+
if (message instanceof RaftRPC) {
RaftRPC rpc = (RaftRPC) message;
// If RPC request or response contains term T > currentTerm:
if (message instanceof ElectionTimeout) {
return RaftState.Candidate;
+
} else if (message instanceof InstallSnapshot) {
- InstallSnapshot snapshot = (InstallSnapshot) message;
- actor().tell(new ApplySnapshot(snapshot), actor());
+ InstallSnapshot installSnapshot = (InstallSnapshot) message;
+ actor().tell(new ApplySnapshot(installSnapshot.getData()), actor());
}
scheduleElection(electionDuration());
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
-import org.opendaylight.controller.cluster.raft.internal.messages.ApplyState;
-import org.opendaylight.controller.cluster.raft.internal.messages.Replicate;
-import org.opendaylight.controller.cluster.raft.internal.messages.SendHeartBeat;
-import org.opendaylight.controller.cluster.raft.internal.messages.SendInstallSnapshot;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
+import org.opendaylight.controller.cluster.raft.base.messages.Replicate;
+import org.opendaylight.controller.cluster.raft.base.messages.SendHeartBeat;
+import org.opendaylight.controller.cluster.raft.base.messages.SendInstallSnapshot;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
import org.opendaylight.controller.cluster.raft.messages.InstallSnapshot;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
private final Map<String, FollowerLogInformation> followerToLog =
new HashMap();
- private final Map<String, ActorSelection> followerToActor = new HashMap<>();
+ private final Set<String> followers;
private Cancellable heartbeatSchedule = null;
private Cancellable appendEntriesSchedule = null;
context.setCommitIndex(lastIndex());
}
- for (String followerId : context.getPeerAddresses().keySet()) {
+ followers = context.getPeerAddresses().keySet();
+
+ for (String followerId : followers) {
FollowerLogInformation followerLogInformation =
new FollowerLogInformationImpl(followerId,
new AtomicLong(lastIndex()),
new AtomicLong(-1));
- followerToActor.put(followerId,
- context.actorSelection(context.getPeerAddress(followerId)));
-
followerToLog.put(followerId, followerLogInformation);
}
- context.getLogger().debug("Election:Leader has following peers:"+followerToActor.keySet());
+ context.getLogger().debug("Election:Leader has following peers:"+ followers);
- if (followerToActor.size() > 0) {
- minReplicationCount = (followerToActor.size() + 1) / 2 + 1;
+ if (followers.size() > 0) {
+ minReplicationCount = (followers.size() + 1) / 2 + 1;
} else {
minReplicationCount = 0;
}
@Override protected RaftState handleAppendEntries(ActorRef sender,
AppendEntries appendEntries) {
+ context.getLogger().info("Leader: Received {}", appendEntries.toString());
+
return state();
}
@Override protected RaftState handleAppendEntriesReply(ActorRef sender,
AppendEntriesReply appendEntriesReply) {
+ if(! appendEntriesReply.isSuccess()) {
+ context.getLogger()
+ .info("Leader: Received {}", appendEntriesReply.toString());
+ }
+
// Update the FollowerLogInformation
String followerId = appendEntriesReply.getFollowerId();
FollowerLogInformation followerLogInformation =
followerToLog.get(followerId);
+
+ if(followerLogInformation == null){
+ context.getLogger().error("Unknown follower {}", followerId);
+ return state();
+ }
+
if (appendEntriesReply.isSuccess()) {
followerLogInformation
.setMatchIndex(appendEntriesReply.getLogLastIndex());
return RaftState.Leader;
}
- @Override public RaftState handleMessage(ActorRef sender, Object message) {
+ @Override public RaftState handleMessage(ActorRef sender, Object originalMessage) {
Preconditions.checkNotNull(sender, "sender should not be null");
+ Object message = fromSerializableMessage(originalMessage);
+
if (message instanceof RaftRPC) {
RaftRPC rpc = (RaftRPC) message;
// If RPC request or response contains term T > currentTerm:
context.getLogger().debug("Replicate message " + logIndex);
- if (followerToActor.size() == 0) {
+ if (followers.size() == 0) {
context.setCommitIndex(
replicate.getReplicatedLogEntry().getIndex());
private void sendAppendEntries() {
// Send an AppendEntries to all followers
- for (String followerId : followerToActor.keySet()) {
+ for (String followerId : followers) {
ActorSelection followerActor =
- followerToActor.get(followerId);
+ context.getPeerActorSelection(followerId);
- FollowerLogInformation followerLogInformation =
- followerToLog.get(followerId);
+ if (followerActor != null) {
+ FollowerLogInformation followerLogInformation =
+ followerToLog.get(followerId);
- long nextIndex = followerLogInformation.getNextIndex().get();
+ long nextIndex = followerLogInformation.getNextIndex().get();
- List<ReplicatedLogEntry> entries = Collections.emptyList();
+ List<ReplicatedLogEntry> entries = Collections.emptyList();
- if(context.getReplicatedLog().isPresent(nextIndex)){
- // TODO: Instead of sending all entries from nextIndex
- // only send a fixed number of entries to each follower
- // This is to avoid the situation where there are a lot of
- // entries to install for a fresh follower or to a follower
- // that has fallen too far behind with the log but yet is not
- // eligible to receive a snapshot
- entries =
- context.getReplicatedLog().getFrom(nextIndex);
- }
+ if (context.getReplicatedLog().isPresent(nextIndex)) {
+ // TODO: Instead of sending all entries from nextIndex
+ // only send a fixed number of entries to each follower
+ // This is to avoid the situation where there are a lot of
+ // entries to install for a fresh follower or to a follower
+ // that has fallen too far behind with the log but yet is not
+ // eligible to receive a snapshot
+ entries =
+ context.getReplicatedLog().getFrom(nextIndex);
+ }
- followerActor.tell(
- new AppendEntries(currentTerm(), context.getId(),
- prevLogIndex(nextIndex), prevLogTerm(nextIndex),
- entries, context.getCommitIndex()
- ),
- actor()
- );
+ followerActor.tell(
+ new AppendEntries(currentTerm(), context.getId(),
+ prevLogIndex(nextIndex),
+ prevLogTerm(nextIndex), entries,
+ context.getCommitIndex()).toSerializable(),
+ actor()
+ );
+ }
}
}
* snapshots at every heartbeat.
*/
private void installSnapshotIfNeeded(){
- for (String followerId : followerToActor.keySet()) {
+ for (String followerId : followers) {
ActorSelection followerActor =
- followerToActor.get(followerId);
-
- FollowerLogInformation followerLogInformation =
- followerToLog.get(followerId);
-
- long nextIndex = followerLogInformation.getNextIndex().get();
-
- if(!context.getReplicatedLog().isPresent(nextIndex) && context.getReplicatedLog().isInSnapshot(nextIndex)){
- followerActor.tell(
- new InstallSnapshot(currentTerm(), context.getId(),
- context.getReplicatedLog().getSnapshotIndex(),
- context.getReplicatedLog().getSnapshotTerm(),
- context.getReplicatedLog().getSnapshot()
- ),
- actor()
- );
+ context.getPeerActorSelection(followerId);
+
+ if(followerActor != null) {
+ FollowerLogInformation followerLogInformation =
+ followerToLog.get(followerId);
+
+ long nextIndex = followerLogInformation.getNextIndex().get();
+
+ if (!context.getReplicatedLog().isPresent(nextIndex) && context
+ .getReplicatedLog().isInSnapshot(nextIndex)) {
+ followerActor.tell(
+ new InstallSnapshot(currentTerm(), context.getId(),
+ context.getReplicatedLog().getSnapshotIndex(),
+ context.getReplicatedLog().getSnapshotTerm(),
+ context.getReplicatedLog().getSnapshot()
+ ),
+ actor()
+ );
+ }
}
}
}
private RaftState sendHeartBeat() {
- if (followerToActor.size() > 0) {
+ if (followers.size() > 0) {
sendAppendEntries();
}
return state();
}
private void scheduleHeartBeat(FiniteDuration interval) {
- if(followerToActor.keySet().size() == 0){
+ if(followers.size() == 0){
// Optimization - do not bother scheduling a heartbeat as there are
// no followers
return;
private void scheduleInstallSnapshotCheck(FiniteDuration interval) {
- if(followerToActor.keySet().size() == 0){
+ if(followers.size() == 0){
// Optimization - do not bother scheduling a heartbeat as there are
// no followers
return;
this.term = term;
}
+ // added for testing while serialize-messages=on
+ public AbstractRaftRPC() {
+ }
+
public long getTerm() {
return term;
}
-
+ public void setTerm(long term) {
+ this.term = term;
+ }
}
package org.opendaylight.controller.cluster.raft.messages;
+import com.google.protobuf.GeneratedMessage;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
/**
* Invoked by leader to replicate log entries (§5.3); also used as
* heartbeat (§5.2).
*/
public class AppendEntries extends AbstractRaftRPC {
+
+ public static final Class SERIALIZABLE_CLASS = AppendEntriesMessages.AppendEntries.class;
+
+ private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(AppendEntries.class);
+
// So that follower can redirect clients
private final String leaderId;
}
@Override public String toString() {
- return "AppendEntries{" +
- "leaderId='" + leaderId + '\'' +
- ", prevLogIndex=" + prevLogIndex +
- ", prevLogTerm=" + prevLogTerm +
- ", entries=" + entries +
- ", leaderCommit=" + leaderCommit +
- '}';
+ final StringBuilder sb =
+ new StringBuilder("AppendEntries{");
+ sb.append("term=").append(getTerm());
+ sb.append("leaderId='").append(leaderId).append('\'');
+ sb.append(", prevLogIndex=").append(prevLogIndex);
+ sb.append(", prevLogTerm=").append(prevLogTerm);
+ sb.append(", entries=").append(entries);
+ sb.append(", leaderCommit=").append(leaderCommit);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ public <T extends Object> Object toSerializable(){
+ AppendEntriesMessages.AppendEntries.Builder to = AppendEntriesMessages.AppendEntries.newBuilder();
+ to.setTerm(this.getTerm())
+ .setLeaderId(this.getLeaderId())
+ .setPrevLogTerm(this.getPrevLogTerm())
+ .setPrevLogIndex(this.getPrevLogIndex())
+ .setLeaderCommit(this.getLeaderCommit());
+
+ for (ReplicatedLogEntry logEntry : this.getEntries()) {
+
+ AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder arBuilder =
+ AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.newBuilder();
+
+ AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder arpBuilder =
+ AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder();
+
+ //get the client specific payload extensions and add them to the payload builder
+ Map<GeneratedMessage.GeneratedExtension, T> map = logEntry.getData().encode();
+ Iterator<Map.Entry<GeneratedMessage.GeneratedExtension, T>> iter = map.entrySet().iterator();
+
+ while (iter.hasNext()) {
+ Map.Entry<GeneratedMessage.GeneratedExtension, T> entry = iter.next();
+ arpBuilder.setExtension(entry.getKey(), entry.getValue());
+ }
+
+ arpBuilder.setClientPayloadClassName(logEntry.getData().getClientPayloadClassName());
+
+ arBuilder.setData(arpBuilder).setIndex(logEntry.getIndex()).setTerm(logEntry.getTerm());
+ to.addLogEntries(arBuilder);
+ }
+
+ return to.build();
+ }
+
+ public static AppendEntries fromSerializable(Object o){
+ AppendEntriesMessages.AppendEntries from = (AppendEntriesMessages.AppendEntries) o;
+
+ List<ReplicatedLogEntry> logEntryList = new ArrayList<>();
+ for (AppendEntriesMessages.AppendEntries.ReplicatedLogEntry leProtoBuff : from.getLogEntriesList()) {
+
+ Payload payload = null ;
+ try {
+ if(leProtoBuff.getData() != null && leProtoBuff.getData().getClientPayloadClassName() != null) {
+ String clientPayloadClassName = leProtoBuff.getData().getClientPayloadClassName();
+ payload = (Payload)Class.forName(clientPayloadClassName).newInstance();
+ payload = payload.decode(leProtoBuff.getData());
+ payload.setClientPayloadClassName(clientPayloadClassName);
+ } else {
+ LOG.error("Payload is null or payload does not have client payload class name");
+ }
+
+ } catch (InstantiationException e) {
+ LOG.error("InstantiationException when instantiating "+leProtoBuff.getData().getClientPayloadClassName(), e);
+ } catch (IllegalAccessException e) {
+ LOG.error("IllegalAccessException when accessing "+leProtoBuff.getData().getClientPayloadClassName(), e);
+ } catch (ClassNotFoundException e) {
+ LOG.error("ClassNotFoundException when loading "+leProtoBuff.getData().getClientPayloadClassName(), e);
+ }
+ ReplicatedLogEntry logEntry = new ReplicatedLogImplEntry(
+ leProtoBuff.getIndex(), leProtoBuff.getTerm(), payload);
+ logEntryList.add(logEntry);
+ }
+
+ AppendEntries to = new AppendEntries(from.getTerm(),
+ from.getLeaderId(),
+ from.getPrevLogIndex(),
+ from.getPrevLogTerm(),
+ logEntryList,
+ from.getLeaderCommit());
+
+ return to;
}
}
/**
* Reply for the AppendEntriesRpc message
*/
-public class AppendEntriesReply extends AbstractRaftRPC{
+public class AppendEntriesReply extends AbstractRaftRPC {
// true if follower contained entry matching
// prevLogIndex and prevLogTerm
public String getFollowerId() {
return followerId;
}
+
+ @Override public String toString() {
+ final StringBuilder sb =
+ new StringBuilder("AppendEntriesReply{");
+ sb.append("term=").append(term);
+ sb.append(", success=").append(success);
+ sb.append(", logLastIndex=").append(logLastIndex);
+ sb.append(", logLastTerm=").append(logLastTerm);
+ sb.append(", followerId='").append(followerId).append('\'');
+ sb.append('}');
+ return sb.toString();
+ }
}
package org.opendaylight.controller.cluster.raft.messages;
-public interface RaftRPC {
+import java.io.Serializable;
+
+public interface RaftRPC extends Serializable {
public long getTerm();
}
/**
* Invoked by candidates to gather votes (§5.2).
*/
-public class RequestVote extends AbstractRaftRPC{
+public class RequestVote extends AbstractRaftRPC {
// candidate requesting vote
- private final String candidateId;
+ private String candidateId;
// index of candidate’s last log entry (§5.4)
- private final long lastLogIndex;
+ private long lastLogIndex;
// term of candidate’s last log entry (§5.4)
- private final long lastLogTerm;
+ private long lastLogTerm;
public RequestVote(long term, String candidateId, long lastLogIndex,
long lastLogTerm) {
this.lastLogTerm = lastLogTerm;
}
+ // added for testing while serialize-messages=on
+ public RequestVote() {
+ }
+
public long getTerm() {
return term;
}
public long getLastLogTerm() {
return lastLogTerm;
}
+
+ public void setCandidateId(String candidateId) {
+ this.candidateId = candidateId;
+ }
+
+ public void setLastLogIndex(long lastLogIndex) {
+ this.lastLogIndex = lastLogIndex;
+ }
+
+ public void setLastLogTerm(long lastLogTerm) {
+ this.lastLogTerm = lastLogTerm;
+ }
+
+ @Override public String toString() {
+ final StringBuilder sb =
+ new StringBuilder("RequestVote{");
+ sb.append("term='").append(getTerm()).append('\'');
+ sb.append("candidateId='").append(candidateId).append('\'');
+ sb.append(", lastLogIndex=").append(lastLogIndex);
+ sb.append(", lastLogTerm=").append(lastLogTerm);
+ sb.append('}');
+ return sb.toString();
+ }
}
package org.opendaylight.controller.cluster.raft.messages;
-public class RequestVoteReply extends AbstractRaftRPC{
+public class RequestVoteReply extends AbstractRaftRPC {
// true means candidate received vot
private final boolean voteGranted;
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.raft.protobuff.client.messages;
+
+
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+
+import java.util.Map;
+
+/**
+ * An instance of a Payload class is meant to be used as the Payload for
+ * AppendEntries.
+ * <p>
+ *
+ * When an actor which is derived from RaftActor attempts to persistData it
+ * must pass an instance of the Payload class. Similarly when state needs to
+ * be applied to the derived RaftActor it will be passed an instance of the
+ * Payload class.
+ * <p>
+ *
+ * To define your own payload do the following,
+ * <ol>
+ * <li>Create your own protocol buffer message which extends the AppendEntries Payload</li>
+ * <li>Extend this Payload class</li>
+ * <li>Implement encode</li>
+ * <li>Implement decode</li>
+ * </ol>
+ *
+ * Your own protocol buffer message can be create like so, <br/>
+ * <pre>
+ * {@code
+ *
+ * import "AppendEntriesMessages.proto";
+ *
+ * package org.opendaylight.controller.cluster.raft;
+ *
+ * option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+ * option java_outer_classname = "MockPayloadMessages";
+ *
+ * extend AppendEntries.ReplicatedLogEntry.Payload {
+ * optional string value = 2;
+ * }
+ * }
+ * </pre>
+ *
+ */
+public abstract class Payload {
+ private String clientPayloadClassName;
+
+ public String getClientPayloadClassName() {
+ return this.getClass().getName();
+ }
+
+ public void setClientPayloadClassName(String clientPayloadClassName) {
+ this.clientPayloadClassName = clientPayloadClassName;
+ }
+
+ /**
+ * Encode the payload data as a protocol buffer extension.
+ * <p>
+ * TODO: Add more meat in here
+ * @param <T>
+ * @return Map of <GeneratedMessage.GeneratedExtension, T>
+ */
+ public abstract <T extends Object> Map<GeneratedMessage.GeneratedExtension, T> encode();
+
+ /**
+ * Decode the protocol buffer payload into a specific Payload as defined
+ * by the class extending RaftActor
+ *
+ * @param payload The payload in protocol buffer format
+ * @return
+ */
+ public abstract Payload decode(
+ AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payload);
+
+
+
+}
--- /dev/null
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: AppendEntriesMessages.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class AppendEntriesMessages {
+ private AppendEntriesMessages() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ public interface AppendEntriesOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // optional int64 term = 1;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ boolean hasTerm();
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ long getTerm();
+
+ // optional string leaderId = 2;
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ boolean hasLeaderId();
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ java.lang.String getLeaderId();
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ com.google.protobuf.ByteString
+ getLeaderIdBytes();
+
+ // optional int64 prevLogIndex = 3;
+ /**
+ * <code>optional int64 prevLogIndex = 3;</code>
+ */
+ boolean hasPrevLogIndex();
+ /**
+ * <code>optional int64 prevLogIndex = 3;</code>
+ */
+ long getPrevLogIndex();
+
+ // optional int64 prevLogTerm = 4;
+ /**
+ * <code>optional int64 prevLogTerm = 4;</code>
+ */
+ boolean hasPrevLogTerm();
+ /**
+ * <code>optional int64 prevLogTerm = 4;</code>
+ */
+ long getPrevLogTerm();
+
+ // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>
+ getLogEntriesList();
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index);
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ int getLogEntriesCount();
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>
+ getLogEntriesOrBuilderList();
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+ int index);
+
+ // optional int64 leaderCommit = 6;
+ /**
+ * <code>optional int64 leaderCommit = 6;</code>
+ */
+ boolean hasLeaderCommit();
+ /**
+ * <code>optional int64 leaderCommit = 6;</code>
+ */
+ long getLeaderCommit();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries}
+ */
+ public static final class AppendEntries extends
+ com.google.protobuf.GeneratedMessage
+ implements AppendEntriesOrBuilder {
+ // Use AppendEntries.newBuilder() to construct.
+ private AppendEntries(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private AppendEntries(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final AppendEntries defaultInstance;
+ public static AppendEntries getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public AppendEntries getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private AppendEntries(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 8: {
+ bitField0_ |= 0x00000001;
+ term_ = input.readInt64();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ leaderId_ = input.readBytes();
+ break;
+ }
+ case 24: {
+ bitField0_ |= 0x00000004;
+ prevLogIndex_ = input.readInt64();
+ break;
+ }
+ case 32: {
+ bitField0_ |= 0x00000008;
+ prevLogTerm_ = input.readInt64();
+ break;
+ }
+ case 42: {
+ if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+ logEntries_ = new java.util.ArrayList<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>();
+ mutable_bitField0_ |= 0x00000010;
+ }
+ logEntries_.add(input.readMessage(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PARSER, extensionRegistry));
+ break;
+ }
+ case 48: {
+ bitField0_ |= 0x00000010;
+ leaderCommit_ = input.readInt64();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+ logEntries_ = java.util.Collections.unmodifiableList(logEntries_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<AppendEntries> PARSER =
+ new com.google.protobuf.AbstractParser<AppendEntries>() {
+ public AppendEntries parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new AppendEntries(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<AppendEntries> getParserForType() {
+ return PARSER;
+ }
+
+ public interface ReplicatedLogEntryOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // optional int64 term = 1;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ boolean hasTerm();
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ long getTerm();
+
+ // optional int64 index = 2;
+ /**
+ * <code>optional int64 index = 2;</code>
+ */
+ boolean hasIndex();
+ /**
+ * <code>optional int64 index = 2;</code>
+ */
+ long getIndex();
+
+ // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ boolean hasData();
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData();
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry}
+ */
+ public static final class ReplicatedLogEntry extends
+ com.google.protobuf.GeneratedMessage
+ implements ReplicatedLogEntryOrBuilder {
+ // Use ReplicatedLogEntry.newBuilder() to construct.
+ private ReplicatedLogEntry(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private ReplicatedLogEntry(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final ReplicatedLogEntry defaultInstance;
+ public static ReplicatedLogEntry getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public ReplicatedLogEntry getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private ReplicatedLogEntry(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 8: {
+ bitField0_ |= 0x00000001;
+ term_ = input.readInt64();
+ break;
+ }
+ case 16: {
+ bitField0_ |= 0x00000002;
+ index_ = input.readInt64();
+ break;
+ }
+ case 26: {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ subBuilder = data_.toBuilder();
+ }
+ data_ = input.readMessage(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(data_);
+ data_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000004;
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<ReplicatedLogEntry> PARSER =
+ new com.google.protobuf.AbstractParser<ReplicatedLogEntry>() {
+ public ReplicatedLogEntry parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new ReplicatedLogEntry(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<ReplicatedLogEntry> getParserForType() {
+ return PARSER;
+ }
+
+ public interface PayloadOrBuilder extends
+ com.google.protobuf.GeneratedMessage.
+ ExtendableMessageOrBuilder<Payload> {
+
+ // optional string clientPayloadClassName = 1;
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ boolean hasClientPayloadClassName();
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ java.lang.String getClientPayloadClassName();
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getClientPayloadClassNameBytes();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload}
+ */
+ public static final class Payload extends
+ com.google.protobuf.GeneratedMessage.ExtendableMessage<
+ Payload> implements PayloadOrBuilder {
+ // Use Payload.newBuilder() to construct.
+ private Payload(com.google.protobuf.GeneratedMessage.ExtendableBuilder<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, ?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private Payload(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final Payload defaultInstance;
+ public static Payload getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Payload getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private Payload(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ clientPayloadClassName_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<Payload> PARSER =
+ new com.google.protobuf.AbstractParser<Payload>() {
+ public Payload parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new Payload(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<Payload> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // optional string clientPayloadClassName = 1;
+ public static final int CLIENTPAYLOADCLASSNAME_FIELD_NUMBER = 1;
+ private java.lang.Object clientPayloadClassName_;
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public boolean hasClientPayloadClassName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public java.lang.String getClientPayloadClassName() {
+ java.lang.Object ref = clientPayloadClassName_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ clientPayloadClassName_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getClientPayloadClassNameBytes() {
+ java.lang.Object ref = clientPayloadClassName_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ clientPayloadClassName_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private void initFields() {
+ clientPayloadClassName_ = "";
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!extensionsAreInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ com.google.protobuf.GeneratedMessage
+ .ExtendableMessage<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload>.ExtensionWriter extensionWriter =
+ newExtensionWriter();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getClientPayloadClassNameBytes());
+ }
+ extensionWriter.writeUntil(101, output);
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getClientPayloadClassNameBytes());
+ }
+ size += extensionsSerializedSize();
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.ExtendableBuilder<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, Builder> implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ clientPayloadClassName_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getDefaultInstanceForType() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload build() {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload buildPartial() {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.clientPayloadClassName_ = clientPayloadClassName_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) {
+ return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload other) {
+ if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) return this;
+ if (other.hasClientPayloadClassName()) {
+ bitField0_ |= 0x00000001;
+ clientPayloadClassName_ = other.clientPayloadClassName_;
+ onChanged();
+ }
+ this.mergeExtensionFields(other);
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!extensionsAreInitialized()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // optional string clientPayloadClassName = 1;
+ private java.lang.Object clientPayloadClassName_ = "";
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public boolean hasClientPayloadClassName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public java.lang.String getClientPayloadClassName() {
+ java.lang.Object ref = clientPayloadClassName_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ clientPayloadClassName_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getClientPayloadClassNameBytes() {
+ java.lang.Object ref = clientPayloadClassName_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ clientPayloadClassName_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public Builder setClientPayloadClassName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ clientPayloadClassName_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public Builder clearClientPayloadClassName() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ clientPayloadClassName_ = getDefaultInstance().getClientPayloadClassName();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string clientPayloadClassName = 1;</code>
+ */
+ public Builder setClientPayloadClassNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ clientPayloadClassName_ = value;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload)
+ }
+
+ static {
+ defaultInstance = new Payload(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload)
+ }
+
+ private int bitField0_;
+ // optional int64 term = 1;
+ public static final int TERM_FIELD_NUMBER = 1;
+ private long term_;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public boolean hasTerm() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public long getTerm() {
+ return term_;
+ }
+
+ // optional int64 index = 2;
+ public static final int INDEX_FIELD_NUMBER = 2;
+ private long index_;
+ /**
+ * <code>optional int64 index = 2;</code>
+ */
+ public boolean hasIndex() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional int64 index = 2;</code>
+ */
+ public long getIndex() {
+ return index_;
+ }
+
+ // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+ public static final int DATA_FIELD_NUMBER = 3;
+ private org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_;
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public boolean hasData() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
+ return data_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
+ return data_;
+ }
+
+ private void initFields() {
+ term_ = 0L;
+ index_ = 0L;
+ data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (hasData()) {
+ if (!getData().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeInt64(1, term_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeInt64(2, index_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeMessage(3, data_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(1, term_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(2, index_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(3, data_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getDataFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ term_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ index_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ if (dataBuilder_ == null) {
+ data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+ } else {
+ dataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getDefaultInstanceForType() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry build() {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry buildPartial() {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.term_ = term_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.index_ = index_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ if (dataBuilder_ == null) {
+ result.data_ = data_;
+ } else {
+ result.data_ = dataBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) {
+ return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry other) {
+ if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance()) return this;
+ if (other.hasTerm()) {
+ setTerm(other.getTerm());
+ }
+ if (other.hasIndex()) {
+ setIndex(other.getIndex());
+ }
+ if (other.hasData()) {
+ mergeData(other.getData());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (hasData()) {
+ if (!getData().isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // optional int64 term = 1;
+ private long term_ ;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public boolean hasTerm() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public long getTerm() {
+ return term_;
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public Builder setTerm(long value) {
+ bitField0_ |= 0x00000001;
+ term_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public Builder clearTerm() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ term_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional int64 index = 2;
+ private long index_ ;
+ /**
+ * <code>optional int64 index = 2;</code>
+ */
+ public boolean hasIndex() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional int64 index = 2;</code>
+ */
+ public long getIndex() {
+ return index_;
+ }
+ /**
+ * <code>optional int64 index = 2;</code>
+ */
+ public Builder setIndex(long value) {
+ bitField0_ |= 0x00000002;
+ index_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 index = 2;</code>
+ */
+ public Builder clearIndex() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ index_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+ private org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder> dataBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public boolean hasData() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
+ if (dataBuilder_ == null) {
+ return data_;
+ } else {
+ return dataBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public Builder setData(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
+ if (dataBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ data_ = value;
+ onChanged();
+ } else {
+ dataBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public Builder setData(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder builderForValue) {
+ if (dataBuilder_ == null) {
+ data_ = builderForValue.build();
+ onChanged();
+ } else {
+ dataBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public Builder mergeData(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
+ if (dataBuilder_ == null) {
+ if (((bitField0_ & 0x00000004) == 0x00000004) &&
+ data_ != org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) {
+ data_ =
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder(data_).mergeFrom(value).buildPartial();
+ } else {
+ data_ = value;
+ }
+ onChanged();
+ } else {
+ dataBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public Builder clearData() {
+ if (dataBuilder_ == null) {
+ data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+ onChanged();
+ } else {
+ dataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder getDataBuilder() {
+ bitField0_ |= 0x00000004;
+ onChanged();
+ return getDataFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
+ if (dataBuilder_ != null) {
+ return dataBuilder_.getMessageOrBuilder();
+ } else {
+ return data_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder>
+ getDataFieldBuilder() {
+ if (dataBuilder_ == null) {
+ dataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder>(
+ data_,
+ getParentForChildren(),
+ isClean());
+ data_ = null;
+ }
+ return dataBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry)
+ }
+
+ static {
+ defaultInstance = new ReplicatedLogEntry(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry)
+ }
+
+ private int bitField0_;
+ // optional int64 term = 1;
+ public static final int TERM_FIELD_NUMBER = 1;
+ private long term_;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public boolean hasTerm() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public long getTerm() {
+ return term_;
+ }
+
+ // optional string leaderId = 2;
+ public static final int LEADERID_FIELD_NUMBER = 2;
+ private java.lang.Object leaderId_;
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public boolean hasLeaderId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public java.lang.String getLeaderId() {
+ java.lang.Object ref = leaderId_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ leaderId_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getLeaderIdBytes() {
+ java.lang.Object ref = leaderId_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ leaderId_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional int64 prevLogIndex = 3;
+ public static final int PREVLOGINDEX_FIELD_NUMBER = 3;
+ private long prevLogIndex_;
+ /**
+ * <code>optional int64 prevLogIndex = 3;</code>
+ */
+ public boolean hasPrevLogIndex() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional int64 prevLogIndex = 3;</code>
+ */
+ public long getPrevLogIndex() {
+ return prevLogIndex_;
+ }
+
+ // optional int64 prevLogTerm = 4;
+ public static final int PREVLOGTERM_FIELD_NUMBER = 4;
+ private long prevLogTerm_;
+ /**
+ * <code>optional int64 prevLogTerm = 4;</code>
+ */
+ public boolean hasPrevLogTerm() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional int64 prevLogTerm = 4;</code>
+ */
+ public long getPrevLogTerm() {
+ return prevLogTerm_;
+ }
+
+ // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+ public static final int LOGENTRIES_FIELD_NUMBER = 5;
+ private java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_;
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
+ return logEntries_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>
+ getLogEntriesOrBuilderList() {
+ return logEntries_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public int getLogEntriesCount() {
+ return logEntries_.size();
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
+ return logEntries_.get(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+ int index) {
+ return logEntries_.get(index);
+ }
+
+ // optional int64 leaderCommit = 6;
+ public static final int LEADERCOMMIT_FIELD_NUMBER = 6;
+ private long leaderCommit_;
+ /**
+ * <code>optional int64 leaderCommit = 6;</code>
+ */
+ public boolean hasLeaderCommit() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional int64 leaderCommit = 6;</code>
+ */
+ public long getLeaderCommit() {
+ return leaderCommit_;
+ }
+
+ private void initFields() {
+ term_ = 0L;
+ leaderId_ = "";
+ prevLogIndex_ = 0L;
+ prevLogTerm_ = 0L;
+ logEntries_ = java.util.Collections.emptyList();
+ leaderCommit_ = 0L;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ for (int i = 0; i < getLogEntriesCount(); i++) {
+ if (!getLogEntries(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeInt64(1, term_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getLeaderIdBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeInt64(3, prevLogIndex_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeInt64(4, prevLogTerm_);
+ }
+ for (int i = 0; i < logEntries_.size(); i++) {
+ output.writeMessage(5, logEntries_.get(i));
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeInt64(6, leaderCommit_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(1, term_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getLeaderIdBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(3, prevLogIndex_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(4, prevLogTerm_);
+ }
+ for (int i = 0; i < logEntries_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(5, logEntries_.get(i));
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(6, leaderCommit_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntriesOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getLogEntriesFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ term_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ leaderId_ = "";
+ bitField0_ = (bitField0_ & ~0x00000002);
+ prevLogIndex_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000004);
+ prevLogTerm_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ if (logEntriesBuilder_ == null) {
+ logEntries_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000010);
+ } else {
+ logEntriesBuilder_.clear();
+ }
+ leaderCommit_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000020);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries getDefaultInstanceForType() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries build() {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries buildPartial() {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.term_ = term_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.leaderId_ = leaderId_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.prevLogIndex_ = prevLogIndex_;
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ result.prevLogTerm_ = prevLogTerm_;
+ if (logEntriesBuilder_ == null) {
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ logEntries_ = java.util.Collections.unmodifiableList(logEntries_);
+ bitField0_ = (bitField0_ & ~0x00000010);
+ }
+ result.logEntries_ = logEntries_;
+ } else {
+ result.logEntries_ = logEntriesBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ result.leaderCommit_ = leaderCommit_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries) {
+ return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries other) {
+ if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.getDefaultInstance()) return this;
+ if (other.hasTerm()) {
+ setTerm(other.getTerm());
+ }
+ if (other.hasLeaderId()) {
+ bitField0_ |= 0x00000002;
+ leaderId_ = other.leaderId_;
+ onChanged();
+ }
+ if (other.hasPrevLogIndex()) {
+ setPrevLogIndex(other.getPrevLogIndex());
+ }
+ if (other.hasPrevLogTerm()) {
+ setPrevLogTerm(other.getPrevLogTerm());
+ }
+ if (logEntriesBuilder_ == null) {
+ if (!other.logEntries_.isEmpty()) {
+ if (logEntries_.isEmpty()) {
+ logEntries_ = other.logEntries_;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ } else {
+ ensureLogEntriesIsMutable();
+ logEntries_.addAll(other.logEntries_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.logEntries_.isEmpty()) {
+ if (logEntriesBuilder_.isEmpty()) {
+ logEntriesBuilder_.dispose();
+ logEntriesBuilder_ = null;
+ logEntries_ = other.logEntries_;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ logEntriesBuilder_ =
+ com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getLogEntriesFieldBuilder() : null;
+ } else {
+ logEntriesBuilder_.addAllMessages(other.logEntries_);
+ }
+ }
+ }
+ if (other.hasLeaderCommit()) {
+ setLeaderCommit(other.getLeaderCommit());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ for (int i = 0; i < getLogEntriesCount(); i++) {
+ if (!getLogEntries(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // optional int64 term = 1;
+ private long term_ ;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public boolean hasTerm() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public long getTerm() {
+ return term_;
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public Builder setTerm(long value) {
+ bitField0_ |= 0x00000001;
+ term_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public Builder clearTerm() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ term_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional string leaderId = 2;
+ private java.lang.Object leaderId_ = "";
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public boolean hasLeaderId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public java.lang.String getLeaderId() {
+ java.lang.Object ref = leaderId_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ leaderId_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getLeaderIdBytes() {
+ java.lang.Object ref = leaderId_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ leaderId_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public Builder setLeaderId(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ leaderId_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public Builder clearLeaderId() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ leaderId_ = getDefaultInstance().getLeaderId();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string leaderId = 2;</code>
+ */
+ public Builder setLeaderIdBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ leaderId_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional int64 prevLogIndex = 3;
+ private long prevLogIndex_ ;
+ /**
+ * <code>optional int64 prevLogIndex = 3;</code>
+ */
+ public boolean hasPrevLogIndex() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional int64 prevLogIndex = 3;</code>
+ */
+ public long getPrevLogIndex() {
+ return prevLogIndex_;
+ }
+ /**
+ * <code>optional int64 prevLogIndex = 3;</code>
+ */
+ public Builder setPrevLogIndex(long value) {
+ bitField0_ |= 0x00000004;
+ prevLogIndex_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 prevLogIndex = 3;</code>
+ */
+ public Builder clearPrevLogIndex() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ prevLogIndex_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional int64 prevLogTerm = 4;
+ private long prevLogTerm_ ;
+ /**
+ * <code>optional int64 prevLogTerm = 4;</code>
+ */
+ public boolean hasPrevLogTerm() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional int64 prevLogTerm = 4;</code>
+ */
+ public long getPrevLogTerm() {
+ return prevLogTerm_;
+ }
+ /**
+ * <code>optional int64 prevLogTerm = 4;</code>
+ */
+ public Builder setPrevLogTerm(long value) {
+ bitField0_ |= 0x00000008;
+ prevLogTerm_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 prevLogTerm = 4;</code>
+ */
+ public Builder clearPrevLogTerm() {
+ bitField0_ = (bitField0_ & ~0x00000008);
+ prevLogTerm_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+ private java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_ =
+ java.util.Collections.emptyList();
+ private void ensureLogEntriesIsMutable() {
+ if (!((bitField0_ & 0x00000010) == 0x00000010)) {
+ logEntries_ = new java.util.ArrayList<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>(logEntries_);
+ bitField0_ |= 0x00000010;
+ }
+ }
+
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> logEntriesBuilder_;
+
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
+ if (logEntriesBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(logEntries_);
+ } else {
+ return logEntriesBuilder_.getMessageList();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public int getLogEntriesCount() {
+ if (logEntriesBuilder_ == null) {
+ return logEntries_.size();
+ } else {
+ return logEntriesBuilder_.getCount();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
+ if (logEntriesBuilder_ == null) {
+ return logEntries_.get(index);
+ } else {
+ return logEntriesBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder setLogEntries(
+ int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+ if (logEntriesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureLogEntriesIsMutable();
+ logEntries_.set(index, value);
+ onChanged();
+ } else {
+ logEntriesBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder setLogEntries(
+ int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+ if (logEntriesBuilder_ == null) {
+ ensureLogEntriesIsMutable();
+ logEntries_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ logEntriesBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder addLogEntries(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+ if (logEntriesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureLogEntriesIsMutable();
+ logEntries_.add(value);
+ onChanged();
+ } else {
+ logEntriesBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder addLogEntries(
+ int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+ if (logEntriesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureLogEntriesIsMutable();
+ logEntries_.add(index, value);
+ onChanged();
+ } else {
+ logEntriesBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder addLogEntries(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+ if (logEntriesBuilder_ == null) {
+ ensureLogEntriesIsMutable();
+ logEntries_.add(builderForValue.build());
+ onChanged();
+ } else {
+ logEntriesBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder addLogEntries(
+ int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+ if (logEntriesBuilder_ == null) {
+ ensureLogEntriesIsMutable();
+ logEntries_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ logEntriesBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder addAllLogEntries(
+ java.lang.Iterable<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> values) {
+ if (logEntriesBuilder_ == null) {
+ ensureLogEntriesIsMutable();
+ super.addAll(values, logEntries_);
+ onChanged();
+ } else {
+ logEntriesBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder clearLogEntries() {
+ if (logEntriesBuilder_ == null) {
+ logEntries_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000010);
+ onChanged();
+ } else {
+ logEntriesBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public Builder removeLogEntries(int index) {
+ if (logEntriesBuilder_ == null) {
+ ensureLogEntriesIsMutable();
+ logEntries_.remove(index);
+ onChanged();
+ } else {
+ logEntriesBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder getLogEntriesBuilder(
+ int index) {
+ return getLogEntriesFieldBuilder().getBuilder(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+ int index) {
+ if (logEntriesBuilder_ == null) {
+ return logEntries_.get(index); } else {
+ return logEntriesBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>
+ getLogEntriesOrBuilderList() {
+ if (logEntriesBuilder_ != null) {
+ return logEntriesBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(logEntries_);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder() {
+ return getLogEntriesFieldBuilder().addBuilder(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder(
+ int index) {
+ return getLogEntriesFieldBuilder().addBuilder(
+ index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+ */
+ public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder>
+ getLogEntriesBuilderList() {
+ return getLogEntriesFieldBuilder().getBuilderList();
+ }
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>
+ getLogEntriesFieldBuilder() {
+ if (logEntriesBuilder_ == null) {
+ logEntriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>(
+ logEntries_,
+ ((bitField0_ & 0x00000010) == 0x00000010),
+ getParentForChildren(),
+ isClean());
+ logEntries_ = null;
+ }
+ return logEntriesBuilder_;
+ }
+
+ // optional int64 leaderCommit = 6;
+ private long leaderCommit_ ;
+ /**
+ * <code>optional int64 leaderCommit = 6;</code>
+ */
+ public boolean hasLeaderCommit() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
+ }
+ /**
+ * <code>optional int64 leaderCommit = 6;</code>
+ */
+ public long getLeaderCommit() {
+ return leaderCommit_;
+ }
+ /**
+ * <code>optional int64 leaderCommit = 6;</code>
+ */
+ public Builder setLeaderCommit(long value) {
+ bitField0_ |= 0x00000020;
+ leaderCommit_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 leaderCommit = 6;</code>
+ */
+ public Builder clearLeaderCommit() {
+ bitField0_ = (bitField0_ & ~0x00000020);
+ leaderCommit_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries)
+ }
+
+ static {
+ defaultInstance = new AppendEntries(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries)
+ }
+
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\033AppendEntriesMessages.proto\022(org.opend" +
+ "aylight.controller.cluster.raft\"\227\003\n\rAppe" +
+ "ndEntries\022\014\n\004term\030\001 \001(\003\022\020\n\010leaderId\030\002 \001(" +
+ "\t\022\024\n\014prevLogIndex\030\003 \001(\003\022\023\n\013prevLogTerm\030\004" +
+ " \001(\003\022^\n\nlogEntries\030\005 \003(\0132J.org.opendayli" +
+ "ght.controller.cluster.raft.AppendEntrie" +
+ "s.ReplicatedLogEntry\022\024\n\014leaderCommit\030\006 \001" +
+ "(\003\032\304\001\n\022ReplicatedLogEntry\022\014\n\004term\030\001 \001(\003\022" +
+ "\r\n\005index\030\002 \001(\003\022`\n\004data\030\003 \001(\0132R.org.opend" +
+ "aylight.controller.cluster.raft.AppendEn",
+ "tries.ReplicatedLogEntry.Payload\032/\n\007Payl" +
+ "oad\022\036\n\026clientPayloadClassName\030\001 \001(\t*\004\010\002\020" +
+ "eBV\n;org.opendaylight.controller.cluster" +
+ ".raft.protobuff.messagesB\025AppendEntriesM" +
+ "essagesH\001"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor,
+ new java.lang.String[] { "Term", "LeaderId", "PrevLogIndex", "PrevLogTerm", "LogEntries", "LeaderCommit", });
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor =
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor.getNestedTypes().get(0);
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor,
+ new java.lang.String[] { "Term", "Index", "Data", });
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor =
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor.getNestedTypes().get(0);
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor,
+ new java.lang.String[] { "ClientPayloadClassName", });
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
--- /dev/null
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: VotingMessages.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class VotingMessages {
+ private VotingMessages() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ public interface RequestVoteOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // optional int64 term = 1;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ boolean hasTerm();
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ long getTerm();
+
+ // optional string candidateId = 2;
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ boolean hasCandidateId();
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ java.lang.String getCandidateId();
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ com.google.protobuf.ByteString
+ getCandidateIdBytes();
+
+ // optional int64 lastLongIndex = 3;
+ /**
+ * <code>optional int64 lastLongIndex = 3;</code>
+ */
+ boolean hasLastLongIndex();
+ /**
+ * <code>optional int64 lastLongIndex = 3;</code>
+ */
+ long getLastLongIndex();
+
+ // optional int64 lastLongTerm = 4;
+ /**
+ * <code>optional int64 lastLongTerm = 4;</code>
+ */
+ boolean hasLastLongTerm();
+ /**
+ * <code>optional int64 lastLongTerm = 4;</code>
+ */
+ long getLastLongTerm();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.cluster.raft.RequestVote}
+ */
+ public static final class RequestVote extends
+ com.google.protobuf.GeneratedMessage
+ implements RequestVoteOrBuilder {
+ // Use RequestVote.newBuilder() to construct.
+ private RequestVote(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private RequestVote(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final RequestVote defaultInstance;
+ public static RequestVote getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public RequestVote getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private RequestVote(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 8: {
+ bitField0_ |= 0x00000001;
+ term_ = input.readInt64();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ candidateId_ = input.readBytes();
+ break;
+ }
+ case 24: {
+ bitField0_ |= 0x00000004;
+ lastLongIndex_ = input.readInt64();
+ break;
+ }
+ case 32: {
+ bitField0_ |= 0x00000008;
+ lastLongTerm_ = input.readInt64();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.class, org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<RequestVote> PARSER =
+ new com.google.protobuf.AbstractParser<RequestVote>() {
+ public RequestVote parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new RequestVote(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<RequestVote> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // optional int64 term = 1;
+ public static final int TERM_FIELD_NUMBER = 1;
+ private long term_;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public boolean hasTerm() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public long getTerm() {
+ return term_;
+ }
+
+ // optional string candidateId = 2;
+ public static final int CANDIDATEID_FIELD_NUMBER = 2;
+ private java.lang.Object candidateId_;
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public boolean hasCandidateId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public java.lang.String getCandidateId() {
+ java.lang.Object ref = candidateId_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ candidateId_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getCandidateIdBytes() {
+ java.lang.Object ref = candidateId_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ candidateId_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional int64 lastLongIndex = 3;
+ public static final int LASTLONGINDEX_FIELD_NUMBER = 3;
+ private long lastLongIndex_;
+ /**
+ * <code>optional int64 lastLongIndex = 3;</code>
+ */
+ public boolean hasLastLongIndex() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional int64 lastLongIndex = 3;</code>
+ */
+ public long getLastLongIndex() {
+ return lastLongIndex_;
+ }
+
+ // optional int64 lastLongTerm = 4;
+ public static final int LASTLONGTERM_FIELD_NUMBER = 4;
+ private long lastLongTerm_;
+ /**
+ * <code>optional int64 lastLongTerm = 4;</code>
+ */
+ public boolean hasLastLongTerm() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional int64 lastLongTerm = 4;</code>
+ */
+ public long getLastLongTerm() {
+ return lastLongTerm_;
+ }
+
+ private void initFields() {
+ term_ = 0L;
+ candidateId_ = "";
+ lastLongIndex_ = 0L;
+ lastLongTerm_ = 0L;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeInt64(1, term_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getCandidateIdBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeInt64(3, lastLongIndex_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeInt64(4, lastLongTerm_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(1, term_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getCandidateIdBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(3, lastLongIndex_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt64Size(4, lastLongTerm_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.cluster.raft.RequestVote}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVoteOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.class, org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ term_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ candidateId_ = "";
+ bitField0_ = (bitField0_ & ~0x00000002);
+ lastLongIndex_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000004);
+ lastLongTerm_ = 0L;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote getDefaultInstanceForType() {
+ return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote build() {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote buildPartial() {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote result = new org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.term_ = term_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.candidateId_ = candidateId_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.lastLongIndex_ = lastLongIndex_;
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ result.lastLongTerm_ = lastLongTerm_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote) {
+ return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote other) {
+ if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.getDefaultInstance()) return this;
+ if (other.hasTerm()) {
+ setTerm(other.getTerm());
+ }
+ if (other.hasCandidateId()) {
+ bitField0_ |= 0x00000002;
+ candidateId_ = other.candidateId_;
+ onChanged();
+ }
+ if (other.hasLastLongIndex()) {
+ setLastLongIndex(other.getLastLongIndex());
+ }
+ if (other.hasLastLongTerm()) {
+ setLastLongTerm(other.getLastLongTerm());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // optional int64 term = 1;
+ private long term_ ;
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public boolean hasTerm() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public long getTerm() {
+ return term_;
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public Builder setTerm(long value) {
+ bitField0_ |= 0x00000001;
+ term_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 term = 1;</code>
+ */
+ public Builder clearTerm() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ term_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional string candidateId = 2;
+ private java.lang.Object candidateId_ = "";
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public boolean hasCandidateId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public java.lang.String getCandidateId() {
+ java.lang.Object ref = candidateId_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ candidateId_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getCandidateIdBytes() {
+ java.lang.Object ref = candidateId_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ candidateId_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public Builder setCandidateId(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ candidateId_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public Builder clearCandidateId() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ candidateId_ = getDefaultInstance().getCandidateId();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string candidateId = 2;</code>
+ */
+ public Builder setCandidateIdBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ candidateId_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional int64 lastLongIndex = 3;
+ private long lastLongIndex_ ;
+ /**
+ * <code>optional int64 lastLongIndex = 3;</code>
+ */
+ public boolean hasLastLongIndex() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional int64 lastLongIndex = 3;</code>
+ */
+ public long getLastLongIndex() {
+ return lastLongIndex_;
+ }
+ /**
+ * <code>optional int64 lastLongIndex = 3;</code>
+ */
+ public Builder setLastLongIndex(long value) {
+ bitField0_ |= 0x00000004;
+ lastLongIndex_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 lastLongIndex = 3;</code>
+ */
+ public Builder clearLastLongIndex() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ lastLongIndex_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // optional int64 lastLongTerm = 4;
+ private long lastLongTerm_ ;
+ /**
+ * <code>optional int64 lastLongTerm = 4;</code>
+ */
+ public boolean hasLastLongTerm() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional int64 lastLongTerm = 4;</code>
+ */
+ public long getLastLongTerm() {
+ return lastLongTerm_;
+ }
+ /**
+ * <code>optional int64 lastLongTerm = 4;</code>
+ */
+ public Builder setLastLongTerm(long value) {
+ bitField0_ |= 0x00000008;
+ lastLongTerm_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int64 lastLongTerm = 4;</code>
+ */
+ public Builder clearLastLongTerm() {
+ bitField0_ = (bitField0_ & ~0x00000008);
+ lastLongTerm_ = 0L;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.RequestVote)
+ }
+
+ static {
+ defaultInstance = new RequestVote(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.RequestVote)
+ }
+
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\024VotingMessages.proto\022(org.opendaylight" +
+ ".controller.cluster.raft\"]\n\013RequestVote\022" +
+ "\014\n\004term\030\001 \001(\003\022\023\n\013candidateId\030\002 \001(\t\022\025\n\rla" +
+ "stLongIndex\030\003 \001(\003\022\024\n\014lastLongTerm\030\004 \001(\003B" +
+ "O\n;org.opendaylight.controller.cluster.r" +
+ "aft.protobuff.messagesB\016VotingMessagesH\001"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor,
+ new java.lang.String[] { "Term", "CandidateId", "LastLongIndex", "LastLongTerm", });
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
--- /dev/null
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "AppendEntriesMessages";
+option optimize_for = SPEED;
+
+message AppendEntries {
+ optional int64 term = 1;
+ optional string leaderId = 2;
+ optional int64 prevLogIndex = 3;
+ optional int64 prevLogTerm = 4;
+
+ message ReplicatedLogEntry {
+ optional int64 term = 1;
+ optional int64 index = 2;
+
+ message Payload {
+ optional string clientPayloadClassName = 1;
+ extensions 2 to 100;
+ }
+
+ optional Payload data = 3;
+ }
+
+ repeated ReplicatedLogEntry logEntries = 5;
+ optional int64 leaderCommit = 6;
+
+}
+
+
--- /dev/null
+package org.opendaylight.controller.cluster.raft;
+
+import "AppendEntriesMessages.proto";
+
+option java_package = "org.opendaylight.controller.cluster.example.protobuff.messages";
+option java_outer_classname = "KeyValueMessages";
+option optimize_for = SPEED;
+
+// proto file for the payload of Example, extending AppendEntries
+extend AppendEntries.ReplicatedLogEntry.Payload {
+ optional string key = 2;
+ optional string value = 3;
+}
--- /dev/null
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "VotingMessages";
+option optimize_for = SPEED;
+
+message RequestVote {
+ optional int64 term = 1;
+ optional string candidateId = 2;
+ optional int64 lastLongIndex = 3;
+ optional int64 lastLongTerm = 4;
+
+}
akka {
+
loglevel = "DEBUG"
+
actor {
+ # enable to test serialization only.
+ # serialize-messages = on
+
serializers {
- java = "akka.serialization.JavaSerializer"
+ java = "akka.serialization.JavaSerializer"
+ proto = "akka.remote.serialization.ProtobufSerializer"
}
serialization-bindings {
- "org.opendaylight.controller.cluster.raft.RaftActor$ReplicatedLogImplEntry" = java
+ "org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry" = java
+ "com.google.protobuf.Message" = proto
+ "com.google.protobuf.GeneratedMessage" = proto
}
}
}
import akka.actor.Props;
import akka.event.Logging;
import akka.event.LoggingAdapter;
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.MockPayloadMessages;
+import com.google.common.base.Preconditions;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
public void initReplicatedLog(){
this.replicatedLog = new SimpleReplicatedLog();
- this.replicatedLog.append(new MockReplicatedLogEntry(1, 1, ""));
+ this.replicatedLog.append(new MockReplicatedLogEntry(1, 1, new MockPayload("")));
}
@Override public ActorRef actorOf(Props props) {
peerAddresses.remove(name);
}
+ @Override public ActorSelection getPeerActorSelection(String peerId) {
+ String peerAddress = getPeerAddress(peerId);
+ if(peerAddress != null){
+ return actorSelection(peerAddress);
+ }
+ return null;
+ }
+
+ @Override public void setPeerAddress(String peerId, String peerAddress) {
+ Preconditions.checkState(peerAddresses.containsKey(peerId));
+ peerAddresses.put(peerId, peerAddress);
+ }
+
public void setPeerAddresses(Map<String, String> peerAddresses) {
this.peerAddresses = peerAddresses;
}
}
}
- public static class MockReplicatedLogEntry implements ReplicatedLogEntry {
+ public static class MockPayload extends Payload implements Serializable {
+ private String value = "";
+
+ public MockPayload(String s) {
+ this.value = s;
+ }
+
+ @Override public Map<GeneratedMessage.GeneratedExtension, String> encode() {
+ Map<GeneratedMessage.GeneratedExtension, String> map = new HashMap<GeneratedMessage.GeneratedExtension, String>();
+ map.put(MockPayloadMessages.value, value);
+ return map;
+ }
+
+ @Override public Payload decode(
+ AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payloadProtoBuff) {
+ String value = payloadProtoBuff.getExtension(MockPayloadMessages.value);
+ this.value = value;
+ return this;
+ }
+
+ @Override public String getClientPayloadClassName() {
+ return MockPayload.class.getName();
+ }
+
+ public String toString() {
+ return value;
+ }
+ }
+
+ public static class MockReplicatedLogEntry implements ReplicatedLogEntry, Serializable {
private final long term;
private final long index;
- private final Object data;
+ private final Payload data;
- public MockReplicatedLogEntry(long term, long index, Object data){
+ public MockReplicatedLogEntry(long term, long index, Payload data){
this.term = term;
this.index = index;
this.data = data;
}
- @Override public Object getData() {
+ @Override public Payload getData() {
return data;
}
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.SerializationUtils;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
import org.opendaylight.controller.cluster.raft.messages.RaftRPC;
import org.opendaylight.controller.cluster.raft.messages.RequestVote;
import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
import java.util.ArrayList;
MockRaftActorContext.SimpleReplicatedLog log =
new MockRaftActorContext.SimpleReplicatedLog();
log.append(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 0, "zero"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
context.setReplicatedLog(log);
List<ReplicatedLogEntry> entries = new ArrayList<>();
entries.add(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 0, "zero"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
AppendEntries appendEntries =
new AppendEntries(2, "leader-1", -1, 1, entries, 0);
log = new MockRaftActorContext.SimpleReplicatedLog();
log.append(
new MockRaftActorContext.MockReplicatedLogEntry(20000,
- 1000000, ""));
+ 1000000, new MockRaftActorContext.MockPayload("")));
((MockRaftActorContext) actorContext).setReplicatedLog(log);
ActorRef actorRef, RaftRPC rpc) {
RaftActorContext actorContext = createActorContext();
+ Payload p = new MockRaftActorContext.MockPayload("");
setLastLogEntry(
- (MockRaftActorContext) actorContext, 0, 0, "");
+ (MockRaftActorContext) actorContext, 0, 0, p);
RaftState raftState = createBehavior(actorContext)
.handleMessage(actorRef, rpc);
}
protected MockRaftActorContext.SimpleReplicatedLog setLastLogEntry(
- MockRaftActorContext actorContext, long term, long index, Object data) {
+ MockRaftActorContext actorContext, long term, long index, Payload data) {
return setLastLogEntry(actorContext,
new MockRaftActorContext.MockReplicatedLogEntry(term, index, data));
}
return new RequestVoteReply(100, false);
}
-
-
+ protected Object fromSerializableMessage(Object serializable){
+ return SerializationUtils.fromSerializable(serializable);
+ }
}
import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
-import org.opendaylight.controller.cluster.raft.internal.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
import org.opendaylight.controller.cluster.raft.messages.RequestVote;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
-import org.opendaylight.controller.cluster.raft.internal.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
import org.opendaylight.controller.cluster.raft.messages.RequestVote;
createActorContext();
context.setLastApplied(100);
- setLastLogEntry((MockRaftActorContext) context, 0, 0, "");
+ setLastLogEntry((MockRaftActorContext) context, 0, 0, new MockRaftActorContext.MockPayload(""));
List<ReplicatedLogEntry> entries =
Arrays.asList(
(ReplicatedLogEntry) new MockRaftActorContext.MockReplicatedLogEntry(100, 101,
- "foo")
+ new MockRaftActorContext.MockPayload("foo"))
);
// The new commitIndex is 101
// Set the last log entry term for the receiver to be greater than
// what we will be sending as the prevLogTerm in AppendEntries
MockRaftActorContext.SimpleReplicatedLog mockReplicatedLog =
- setLastLogEntry(context, 20, 0, "");
+ setLastLogEntry(context, 20, 0, new MockRaftActorContext.MockPayload(""));
// AppendEntries is now sent with a bigger term
// this will set the receivers term to be the same as the sender's term
MockRaftActorContext.SimpleReplicatedLog log =
new MockRaftActorContext.SimpleReplicatedLog();
log.append(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 0, "zero"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
log.append(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 1, "one"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 1, new MockRaftActorContext.MockPayload("one")));
log.append(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 2, "two"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 2, new MockRaftActorContext.MockPayload("two")));
context.setReplicatedLog(log);
// Prepare the entries to be sent with AppendEntries
List<ReplicatedLogEntry> entries = new ArrayList<>();
entries.add(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 3, "three"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 3, new MockRaftActorContext.MockPayload("three")));
entries.add(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 4, "four"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 4, new MockRaftActorContext.MockPayload("four")));
// Send appendEntries with the same term as was set on the receiver
// before the new behavior was created (1 in this case)
MockRaftActorContext.SimpleReplicatedLog log =
new MockRaftActorContext.SimpleReplicatedLog();
log.append(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 0, "zero"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
log.append(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 1, "one"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 1, new MockRaftActorContext.MockPayload("one")));
log.append(
- new MockRaftActorContext.MockReplicatedLogEntry(1, 2, "two"));
+ new MockRaftActorContext.MockReplicatedLogEntry(1, 2, new MockRaftActorContext.MockPayload("two")));
context.setReplicatedLog(log);
// Prepare the entries to be sent with AppendEntries
List<ReplicatedLogEntry> entries = new ArrayList<>();
entries.add(
- new MockRaftActorContext.MockReplicatedLogEntry(2, 2, "two-1"));
+ new MockRaftActorContext.MockReplicatedLogEntry(2, 2, new MockRaftActorContext.MockPayload("two-1")));
entries.add(
- new MockRaftActorContext.MockReplicatedLogEntry(2, 3, "three"));
+ new MockRaftActorContext.MockReplicatedLogEntry(2, 3, new MockRaftActorContext.MockPayload("three")));
// Send appendEntries with the same term as was set on the receiver
// before the new behavior was created (1 in this case)
assertEquals(4, log.last().getIndex() + 1);
assertNotNull(log.get(2));
-
- assertEquals("one", log.get(1).getData());
+ assertEquals("one", log.get(1).getData().toString());
// Check that the entry at index 2 has the new data
- assertEquals("two-1", log.get(2).getData());
+ assertEquals("two-1", log.get(2).getData().toString());
+
+ assertEquals("three", log.get(3).getData().toString());
- assertEquals("three", log.get(3).getData());
assertNotNull(log.get(3));
// Also expect an AppendEntriesReply to be sent where success is false
import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
-import org.opendaylight.controller.cluster.raft.internal.messages.ApplyState;
-import org.opendaylight.controller.cluster.raft.internal.messages.Replicate;
-import org.opendaylight.controller.cluster.raft.internal.messages.SendHeartBeat;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
+import org.opendaylight.controller.cluster.raft.base.messages.Replicate;
+import org.opendaylight.controller.cluster.raft.base.messages.SendHeartBeat;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
leader.handleMessage(senderActor, new SendHeartBeat());
final String out =
- new ExpectMsg<String>(duration("1 seconds"),
- "match hint") {
+ new ExpectMsg<String>(duration("1 seconds"), "match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof AppendEntries) {
- if (((AppendEntries) in).getTerm()
- == 0) {
+ Object msg = fromSerializableMessage(in);
+ if (msg instanceof AppendEntries) {
+ if (((AppendEntries)msg).getTerm() == 0) {
return "match";
}
return null;
.handleMessage(senderActor, new Replicate(null, null,
new MockRaftActorContext.MockReplicatedLogEntry(1,
100,
- "foo")
+ new MockRaftActorContext.MockPayload("foo"))
));
// State should not change
assertEquals(RaftState.Leader, raftState);
final String out =
- new ExpectMsg<String>(duration("1 seconds"),
- "match hint") {
+ new ExpectMsg<String>(duration("1 seconds"), "match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof AppendEntries) {
- if (((AppendEntries) in).getTerm()
- == 0) {
+ Object msg = fromSerializableMessage(in);
+ if (msg instanceof AppendEntries) {
+ if (((AppendEntries)msg).getTerm() == 0) {
return "match";
}
return null;
.handleMessage(senderActor, new Replicate(null, "state-id",
new MockRaftActorContext.MockReplicatedLogEntry(1,
100,
- "foo")
+ new MockRaftActorContext.MockPayload("foo"))
));
// State should not change
--- /dev/null
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: MockPayload.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class MockPayloadMessages {
+ private MockPayloadMessages() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registry.add(org.opendaylight.controller.cluster.raft.protobuff.messages.MockPayloadMessages.value);
+ }
+ public static final int VALUE_FIELD_NUMBER = 2;
+ /**
+ * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+ */
+ public static final
+ com.google.protobuf.GeneratedMessage.GeneratedExtension<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+ java.lang.String> value = com.google.protobuf.GeneratedMessage
+ .newFileScopedGeneratedExtension(
+ java.lang.String.class,
+ null);
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\021MockPayload.proto\022(org.opendaylight.co" +
+ "ntroller.cluster.raft\032\033AppendEntriesMess" +
+ "ages.proto:a\n\005value\022R.org.opendaylight.c" +
+ "ontroller.cluster.raft.AppendEntries.Rep" +
+ "licatedLogEntry.Payload\030\002 \001(\tBR\n;org.ope" +
+ "ndaylight.controller.cluster.raft.protob" +
+ "uff.messagesB\023MockPayloadMessages"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ value.internalInit(descriptor.getExtensions().get(0));
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
--- /dev/null
+import "AppendEntriesMessages.proto";
+
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "MockPayloadMessages";
+
+extend AppendEntries.ReplicatedLogEntry.Payload {
+ optional string value = 2;
+}
akka {
+
+ loglevel = "DEBUG"
+
actor {
+ # enable to test serialization only.
+ serialize-messages = on
+
serializers {
- java = "akka.serialization.JavaSerializer"
+ java = "akka.serialization.JavaSerializer"
+ proto = "akka.remote.serialization.ProtobufSerializer"
}
serialization-bindings {
- "org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification" = java
+ "org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry" = java
+ "com.google.protobuf.Message" = proto
+ "com.google.protobuf.GeneratedMessage" = proto
}
}
-}
\ No newline at end of file
+}
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
import org.opendaylight.yangtools.yang.data.impl.codec.CodecRegistry;
import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
}
@Override
- public Entry<InstanceIdentifier, CompositeNode> toDataDom(
+ public Entry<YangInstanceIdentifier, CompositeNode> toDataDom(
Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject> entry) {
return delegate.toDataDom(entry);
}
@Override
- public InstanceIdentifier toDataDom(
+ public YangInstanceIdentifier toDataDom(
org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> path) {
return delegate.toDataDom(path);
}
}
@Override
- public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> fromDataDom(InstanceIdentifier entry)
+ public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> fromDataDom(YangInstanceIdentifier entry)
throws DeserializationException {
return delegate.fromDataDom(entry);
}
*/
package org.opendaylight.controller.md.sal.binding.impl;
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
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.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.collect.Iterables;
-
-public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBroker>, DomForwardedBroker,
- SchemaContextListener, AutoCloseable {
+public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBroker>, DomForwardedBroker, SchemaContextListener, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(AbstractForwardedDataBroker.class);
// The Broker to whom we do all forwarding
final DataChangeScope triggeringScope) {
DOMDataChangeListener domDataChangeListener = new TranslatingDataChangeInvoker(store, path, listener,
triggeringScope);
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = codec.toNormalized(path);
+ YangInstanceIdentifier domPath = codec.toNormalized(path);
ListenerRegistration<DOMDataChangeListener> domRegistration = domDataBroker.registerDataChangeListener(store,
domPath, domDataChangeListener, triggeringScope);
return new ListenerRegistrationImpl(listener, domRegistration);
}
protected Map<InstanceIdentifier<?>, DataObject> toBinding(
- final Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized) {
+ final Map<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized) {
Map<InstanceIdentifier<?>, DataObject> newMap = new HashMap<>();
- for (Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : sortedEntries(normalized)) {
+ for (Map.Entry<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : sortedEntries(normalized)) {
try {
Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> potential = getCodec().toBinding(
entry);
return newMap;
}
- private static <T> Iterable<Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier,T>> sortedEntries(final Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T> map) {
- ArrayList<Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T>> entries = new ArrayList<>(map.entrySet());
- Collections.sort(entries, new Comparator<Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T>>() {
+ private static final Comparator<Entry<YangInstanceIdentifier, ?>> MAP_ENTRY_COMPARATOR = new Comparator<Entry<YangInstanceIdentifier, ?>>() {
+ @Override
+ public int compare(final Entry<YangInstanceIdentifier, ?> left,
+ final Entry<YangInstanceIdentifier, ?> right) {
+ final Iterator<?> li = left.getKey().getPathArguments().iterator();
+ final Iterator<?> ri = right.getKey().getPathArguments().iterator();
+
+ // Iterate until left is exhausted...
+ while (li.hasNext()) {
+ if (!ri.hasNext()) {
+ // Left is deeper
+ return 1;
+ }
- @Override
- public int compare(final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T> left,
- final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T> right) {
- int leftSize = Iterables.size(left.getKey().getPathArguments());
- int rightSize = Iterables.size(right.getKey().getPathArguments());
- return Integer.compare(leftSize, rightSize);
+ li.next();
+ ri.next();
}
- });
- return entries;
+
+ // Check if right is exhausted
+ return ri.hasNext() ? -1 : 0;
+ }
+ };
+
+ private static <T> Iterable<Entry<YangInstanceIdentifier,T>> sortedEntries(final Map<YangInstanceIdentifier, T> map) {
+ if (!map.isEmpty()) {
+ ArrayList<Entry<YangInstanceIdentifier, T>> entries = new ArrayList<>(map.entrySet());
+ Collections.sort(entries, MAP_ENTRY_COMPARATOR);
+ return entries;
+ } else {
+ return Collections.emptySet();
+ }
}
protected Set<InstanceIdentifier<?>> toBinding(
- final Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> normalized) {
+ final Set<YangInstanceIdentifier> normalized) {
Set<InstanceIdentifier<?>> hashSet = new HashSet<>();
- for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath : normalized) {
+ for (YangInstanceIdentifier normalizedPath : normalized) {
try {
Optional<InstanceIdentifier<? extends DataObject>> potential = getCodec().toBinding(normalizedPath);
if (potential.isPresent()) {
@Override
public void onDataChanged(
- final AsyncDataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> change) {
+ final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
bindingDataChangeListener.onDataChanged(new TranslatedDataChangeEvent(change, path));
}
}
private class TranslatedDataChangeEvent implements AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> {
- private final AsyncDataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> domEvent;
+ private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> domEvent;
private final InstanceIdentifier<?> path;
private Map<InstanceIdentifier<?>, DataObject> createdCache;
private Optional<DataObject> updatedDataCache;
public TranslatedDataChangeEvent(
- final AsyncDataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> change,
+ final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change,
final InstanceIdentifier<?> path) {
this.domEvent = change;
this.path = path;
import org.opendaylight.yangtools.concepts.Delegator;
import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.ListenableFuture;
-abstract class AbstractForwardedTransaction<T extends AsyncTransaction<InstanceIdentifier, NormalizedNode<?, ?>>>
+abstract class AbstractForwardedTransaction<T extends AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>>>
implements Delegator<T>, Identifiable<Object> {
private final T delegate;
}
@SuppressWarnings("unchecked")
- protected final <S extends AsyncTransaction<InstanceIdentifier, NormalizedNode<?, ?>>> S getDelegateChecked(final Class<S> txType) {
+ protected final <S extends AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>>> S getDelegateChecked(final Class<S> txType) {
Preconditions.checkState(txType.isInstance(delegate));
return (S) delegate;
}
import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationOperation;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Override
protected final void ensureParentsByMerge(final LogicalDatastoreType store,
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath,
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath,
final InstanceIdentifier<?> path) {
List<PathArgument> currentArguments = new ArrayList<>();
DataNormalizationOperation<?> currentOp = getCodec().getDataNormalizer().getRootOperation();
throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", path), e);
}
currentArguments.add(currentArg);
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(
currentArguments);
final Optional<NormalizedNode<?, ?>> d;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Identifiable;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final <U extends DataObject> void put(final LogicalDatastoreType store,
final InstanceIdentifier<U> path, final U data, final boolean createParents) {
- final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
+ final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
.toNormalizedNode(path, data);
if(createParents) {
ensureParentsByMerge(store, normalized.getKey(), path);
public final <U extends DataObject> void merge(final LogicalDatastoreType store,
final InstanceIdentifier<U> path, final U data,final boolean createParents) {
- final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
+ final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
.toNormalizedNode(path, data);
if(createParents) {
* @param normalized Normalized version of data to be written
*/
private void ensureListParentIfNeeded(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
- final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized) {
+ final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> normalized) {
if(Identifiable.class.isAssignableFrom(path.getTargetType())) {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentMapPath = getParent(normalized.getKey()).get();
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentMapPath = getParent(normalized.getKey()).get();
NormalizedNode<?, ?> emptyParent = getCodec().getDefaultNodeFor(parentMapPath);
getDelegate().merge(store, parentMapPath, emptyParent);
}
}
// FIXME (should be probaly part of InstanceIdentifier)
- protected static Optional<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getParent(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier child) {
+ protected static Optional<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getParent(
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier child) {
Iterable<PathArgument> mapEntryItemPath = child.getPathArguments();
int parentPathSize = Iterables.size(mapEntryItemPath) - 1;
if(parentPathSize > 1) {
- return Optional.of(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(Iterables.limit(mapEntryItemPath, parentPathSize)));
+ return Optional.of(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(Iterables.limit(mapEntryItemPath, parentPathSize)));
} else if(parentPathSize == 0) {
- return Optional.of(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(Collections.<PathArgument>emptyList()));
+ return Optional.of(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(Collections.<PathArgument>emptyList()));
} else {
return Optional.absent();
}
* @param path
*/
protected abstract void ensureParentsByMerge(LogicalDatastoreType store,
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier key, InstanceIdentifier<?> path);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier key, InstanceIdentifier<?> path);
protected final void doDelete(final LogicalDatastoreType store,
final InstanceIdentifier<?> path) {
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized = getCodec().toNormalized(path);
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized = getCodec().toNormalized(path);
getDelegate().delete(store, normalized);
}
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.ListenableFuture;
@Override
protected void ensureParentsByMerge(final LogicalDatastoreType store,
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath, final InstanceIdentifier<?> path) {
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath, final InstanceIdentifier<?> path) {
List<PathArgument> currentArguments = new ArrayList<>();
DataNormalizationOperation<?> currentOp = getCodec().getDataNormalizer().getRootOperation();
Iterator<PathArgument> iterator = normalizedPath.getPathArguments().iterator();
throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", path), e);
}
currentArguments.add(currentArg);
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(
currentArguments);
getDelegate().merge(store, currentPath, currentOp.createDefault(currentArg));
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
this.bindingToLegacy = mappingService;
}
- public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier toNormalized(
+ public org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toNormalized(
final InstanceIdentifier<? extends DataObject> binding) {
// Used instance-identifier codec do not support serialization of last
return toNormalizedImpl(binding);
}
- public Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
+ public Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
final InstanceIdentifier<? extends DataObject> bindingPath, final DataObject bindingObject) {
return toNormalizedNode(toBindingEntry(bindingPath, bindingObject));
}
- public Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
+ public Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
final Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject> binding) {
- Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> legacyEntry = bindingToLegacy
+ Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> legacyEntry = bindingToLegacy
.toDataDom(binding);
- Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalizedEntry = legacyToNormalized
+ Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedEntry = legacyToNormalized
.toNormalized(legacyEntry);
LOG.trace("Serialization of {}, Legacy Representation: {}, Normalized Representation: {}", binding,
legacyEntry, normalizedEntry);
if (child instanceof AugmentationNode) {
ImmutableList<PathArgument> childArgs = ImmutableList.<PathArgument> builder()
.addAll(normalizedEntry.getKey().getPathArguments()).add(child.getIdentifier()).build();
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier childPath = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier childPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
.create(childArgs);
return toDOMEntry(childPath, child);
}
*
*/
public Optional<InstanceIdentifier<? extends DataObject>> toBinding(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
throws DeserializationException {
PathArgument lastArgument = Iterables.getLast(normalized.getPathArguments());
}
private Optional<InstanceIdentifier<? extends DataObject>> toBindingAugmented(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
throws DeserializationException {
Optional<InstanceIdentifier<? extends DataObject>> potential = toBindingImpl(normalized);
// Shorthand check, if codec already supports deserialization
// path.
LOG.trace("Looking for candidates to match {}", normalized);
for (QName child : lastArgument.getPossibleChildNames()) {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier childPath = normalized.node(child);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier childPath = normalized.node(child);
try {
if (isNotRepresentable(childPath)) {
LOG.trace("Path {} is not BI-representable, skipping it", childPath);
}
private Optional<InstanceIdentifier<? extends DataObject>> toBindingImpl(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
throws DeserializationException {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier legacyPath;
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier legacyPath;
try {
if (isNotRepresentable(normalized)) {
return Optional.<InstanceIdentifier<? extends DataObject>> of(bindingToLegacy.fromDataDom(legacyPath));
}
- private boolean isNotRepresentable(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+ private boolean isNotRepresentable(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
throws DataNormalizationException {
DataNormalizationOperation<?> op = findNormalizationOperation(normalized);
if (op.isMixin() && op.getIdentifier() instanceof NodeIdentifier) {
}
private DataNormalizationOperation<?> findNormalizationOperation(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
throws DataNormalizationException {
DataNormalizationOperation<?> current = legacyToNormalized.getRootOperation();
for (PathArgument arg : normalized.getPathArguments()) {
key, value);
}
- private static final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> toDOMEntry(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier key, final NormalizedNode<?, ?> value) {
- return new SimpleEntry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>>(key,
+ private static final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> toDOMEntry(
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier key, final NormalizedNode<?, ?> value) {
+ return new SimpleEntry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>>(key,
value);
}
}
public Optional<Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject>> toBinding(
- final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized)
+ final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized)
throws DeserializationException {
Optional<InstanceIdentifier<? extends DataObject>> potentialPath = toBinding(normalized.getKey());
if (potentialPath.isPresent()) {
legacyToNormalized = new DataNormalizer(arg0);
}
- private org.opendaylight.yangtools.yang.data.api.InstanceIdentifier toNormalizedAugmented(
+ private org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toNormalizedAugmented(
final InstanceIdentifier<?> augPath) {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier processed = toNormalizedImpl(augPath);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier processed = toNormalizedImpl(augPath);
// If used instance identifier codec added supports for deserialization
// of last AugmentationIdentifier we will just reuse it
if (isAugmentationIdentifier(processed)) {
return processed;
}
- Optional<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> additionalSerialized;
+ Optional<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> additionalSerialized;
additionalSerialized = toNormalizedAugmentedUsingChildContainers(augPath, processed);
if (additionalSerialized.isPresent()) {
* Processed path
* @return
*/
- private Optional<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> toNormalizedAugmentedUsingChildLeafs(
+ private Optional<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> toNormalizedAugmentedUsingChildLeafs(
final InstanceIdentifier<?> augPath,
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentPath) {
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentPath) {
try {
DataNormalizationOperation<?> parentOp = legacyToNormalized.getOperation(parentPath);
if(!parentOp.getDataSchemaNode().isPresent()) {
* @return
*/
@SuppressWarnings("rawtypes")
- private Optional<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> toNormalizedAugmentedUsingChildContainers(
+ private Optional<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> toNormalizedAugmentedUsingChildContainers(
final InstanceIdentifier<?> augPath,
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentPath) {
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentPath) {
for (Class augChild : BindingReflections.getChildrenClasses(augPath.getTargetType())) {
@SuppressWarnings("unchecked")
InstanceIdentifier<?> childPath = augPath.child(augChild);
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized = toNormalizedImpl(childPath);
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier potentialDiscovered = shortenToLastAugmentation(
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized = toNormalizedImpl(childPath);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier potentialDiscovered = shortenToLastAugmentation(
normalized, parentPath);
if (potentialDiscovered != null) {
return Optional.of(potentialDiscovered);
&& method.getName().startsWith("get") && method.getParameterTypes().length == 0;
}
- private org.opendaylight.yangtools.yang.data.api.InstanceIdentifier shortenToLastAugmentation(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized,
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentPath) {
+ private org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier shortenToLastAugmentation(
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized,
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentPath) {
int parentSize = Iterables.size(parentPath.getPathArguments());
int position = 0;
int foundPosition = -1;
}
if (foundPosition > 0 && foundPosition > parentSize) {
Iterable<PathArgument> shortened = Iterables.limit(normalized.getPathArguments(), foundPosition);
- return org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(shortened);
+ return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(shortened);
}
return null;
}
return InstanceIdentifier.create(Iterables.limit(binding.getPathArguments(), foundPosition));
}
- private org.opendaylight.yangtools.yang.data.api.InstanceIdentifier toNormalizedImpl(
+ private org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toNormalizedImpl(
final InstanceIdentifier<? extends DataObject> binding) {
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier legacyPath = bindingToLegacy
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier legacyPath = bindingToLegacy
.toDataDom(binding);
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized = legacyToNormalized
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized = legacyToNormalized
.toNormalized(legacyPath);
return normalized;
}
return Augmentation.class.isAssignableFrom(potential.getTargetType());
}
- private boolean isAugmentationIdentifier(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier processed) {
+ private boolean isAugmentationIdentifier(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier processed) {
return Iterables.getLast(processed.getPathArguments()) instanceof AugmentationIdentifier;
}
return count;
}
- private static int getAugmentationCount(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier potential) {
+ private static int getAugmentationCount(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier potential) {
int count = 0;
for (PathArgument arg : potential.getPathArguments()) {
if (arg instanceof AugmentationIdentifier) {
* @param path DOM Path
* @return Node with defaults set on.
*/
- public NormalizedNode<?, ?> getDefaultNodeFor(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+ public NormalizedNode<?, ?> getDefaultNodeFor(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path) {
Iterator<PathArgument> iterator = path.getPathArguments().iterator();
DataNormalizationOperation<?> currentOp = legacyToNormalized.getRootOperation();
while (iterator.hasNext()) {
AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(BindingIndependentConnector.class);
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier ROOT_BI = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier ROOT_BI = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
.builder().toInstance();
private BindingIndependentMappingService mappingService;
@Override
public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
try {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath = mappingService.toDataDom(path);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath = mappingService.toDataDom(path);
CompositeNode result = biDataService.readOperationalData(biPath);
return potentialAugmentationRead(path, biPath, result);
} catch (DeserializationException e) {
}
private DataObject potentialAugmentationRead(InstanceIdentifier<? extends DataObject> path,
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath, final CompositeNode result)
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath, final CompositeNode result)
throws DeserializationException {
Class<? extends DataObject> targetType = path.getTargetType();
if (Augmentation.class.isAssignableFrom(targetType)) {
@Override
public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
try {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath = mappingService.toDataDom(path);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath = mappingService.toDataDom(path);
CompositeNode result = biDataService.readConfigurationData(biPath);
return potentialAugmentationRead(path, biPath, result);
} catch (DeserializationException e) {
DataModificationTransaction target = biDataService.beginTransaction();
LOG.debug("Created DOM Transaction {} for {},", target.getIdentifier(), source.getIdentifier());
for (InstanceIdentifier<? extends DataObject> entry : source.getRemovedConfigurationData()) {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biEntry = mappingService.toDataDom(entry);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biEntry = mappingService.toDataDom(entry);
target.removeConfigurationData(biEntry);
LOG.debug("Delete of Binding Configuration Data {} is translated to {}", entry, biEntry);
}
for (InstanceIdentifier<? extends DataObject> entry : source.getRemovedOperationalData()) {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biEntry = mappingService.toDataDom(entry);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biEntry = mappingService.toDataDom(entry);
target.removeOperationalData(biEntry);
LOG.debug("Delete of Binding Operational Data {} is translated to {}", entry, biEntry);
}
for (Map.Entry<InstanceIdentifier<? extends DataObject>, DataObject> entry : source.getUpdatedConfigurationData()
.entrySet()) {
- Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> biEntry = mappingService
+ Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> biEntry = mappingService
.toDataDom(entry);
target.putConfigurationData(biEntry.getKey(), biEntry.getValue());
LOG.debug("Update of Binding Configuration Data {} is translated to {}", entry, biEntry);
}
for (Map.Entry<InstanceIdentifier<? extends DataObject>, DataObject> entry : source.getUpdatedOperationalData()
.entrySet()) {
- Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> biEntry = mappingService
+ Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> biEntry = mappingService
.toDataDom(entry);
target.putOperationalData(biEntry.getKey(), biEntry.getValue());
LOG.debug("Update of Binding Operational Data {} is translated to {}", entry, biEntry);
@Deprecated
class DomToBindingCommitHandler implements //
RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier<? extends DataObject>, DataObject>>, //
- DataCommitHandler<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> {
+ DataCommitHandler<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> {
private final Logger LOG = LoggerFactory.getLogger(DomToBindingCommitHandler.class);
}
@Override
- public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> requestCommit(
- final DataModification<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> domTransaction) {
+ public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> requestCommit(
+ final DataModification<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> domTransaction) {
Object identifier = domTransaction.getIdentifier();
/**
}
private org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction createDomToBindingTransaction(
- final DataModification<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> source) {
+ final DataModification<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> source) {
if (baDataService == null) {
final String msg = "Binding Aware Service is not initialized correctly! DOM to Binding Transaction cannot be created for ";
LOG.error(msg + "{}", source);
org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction target = baDataService
.beginTransaction();
- for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier entry : source.getRemovedConfigurationData()) {
+ for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier entry : source.getRemovedConfigurationData()) {
try {
InstanceIdentifier<?> baEntry = mappingService.fromDataDom(entry);
LOG.error("Ommiting from BA transaction: {}.", entry, e);
}
}
- for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier entry : source.getRemovedOperationalData()) {
+ for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier entry : source.getRemovedOperationalData()) {
try {
InstanceIdentifier<?> baEntry = mappingService.fromDataDom(entry);
LOG.error("Ommiting from BA transaction: {}.", entry, e);
}
}
- for (Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> entry : source
+ for (Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> entry : source
.getUpdatedConfigurationData().entrySet()) {
try {
InstanceIdentifier<?> baKey = mappingService.fromDataDom(entry.getKey());
LOG.error("Ommiting from BA transaction: {}.", entry.getKey(), e);
}
}
- for (Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> entry : source
+ for (Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> entry : source
.getUpdatedOperationalData().entrySet()) {
try {
private final RpcProviderRegistry baRpcRegistry;
private final RpcProviderRegistryImpl baRpcRegistryImpl;
- private final Function<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> toDOMInstanceIdentifier;
+ private final Function<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> toDOMInstanceIdentifier;
private final static Method EQUALS_METHOD;
this.rpcServiceType = new WeakReference<Class<? extends RpcService>>(service);
this.supportedRpcs = mappingService.getRpcQNamesFor(service);
- toDOMInstanceIdentifier = new Function<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier>() {
+ toDOMInstanceIdentifier = new Function<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier>() {
@Override
- public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier apply(final InstanceIdentifier<?> input) {
+ public org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier apply(final InstanceIdentifier<?> input) {
return mappingService.toDataDom(input);
}
};
public void registerPaths(final Class<? extends BaseIdentity> context,
final Class<? extends RpcService> service, final Set<InstanceIdentifier<?>> set) {
QName ctx = BindingReflections.findQName(context);
- for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path : FluentIterable.from(set).transform(
+ for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path : FluentIterable.from(set).transform(
toDOMInstanceIdentifier)) {
for (org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration reg : registrations) {
reg.registerPath(ctx, path);
public void removePaths(final Class<? extends BaseIdentity> context, final Class<? extends RpcService> service,
final Set<InstanceIdentifier<?>> set) {
QName ctx = BindingReflections.findQName(context);
- for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path : FluentIterable.from(set).transform(
+ for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path : FluentIterable.from(set).transform(
toDOMInstanceIdentifier)) {
for (org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration reg : registrations) {
reg.unregisterPath(ctx, path);
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
class DomToBindingTransaction implements
- DataCommitHandler.DataCommitTransaction<InstanceIdentifier, CompositeNode> {
+ DataCommitHandler.DataCommitTransaction<YangInstanceIdentifier, CompositeNode> {
private final org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction backing;
- private final DataModification<InstanceIdentifier, CompositeNode> modification;
+ private final DataModification<YangInstanceIdentifier, CompositeNode> modification;
private final ConcurrentMap<Object, DomToBindingTransaction> bindingOpenedTransactions;
public DomToBindingTransaction(
final org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction backing,
- final DataModification<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> modification,
+ final DataModification<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> modification,
ConcurrentMap<Object, DomToBindingTransaction> bindingOpenedTransactions) {
super();
this.backing = backing;
}
@Override
- public DataModification<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getModification() {
+ public DataModification<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getModification() {
return modification;
}
private final BindingMountPointForwardingManager bindingForwardingManager = new BindingMountPointForwardingManager();
private ConcurrentMap<InstanceIdentifier<?>, BindingIndependentConnector> connectors = new ConcurrentHashMap<>();
- private ConcurrentMap<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> forwarded = new ConcurrentHashMap<>();
+ private ConcurrentMap<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> forwarded = new ConcurrentHashMap<>();
private ListenerRegistration<MountProvisionListener> domListenerRegistration;
private ListenerRegistration<org.opendaylight.controller.sal.binding.api.mount.MountProviderService.MountProvisionListener> baListenerRegistration;
}
private void tryToDeployConnector(InstanceIdentifier<?> baPath,
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier previous = forwarded.putIfAbsent(baPath, biPath);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath) {
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier previous = forwarded.putIfAbsent(baPath, biPath);
if (previous != null) {
return;
}
return mountConnector;
}
- public synchronized void tryToDeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath) {
+ public synchronized void tryToDeployDomForwarder(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath) {
InstanceIdentifier<?> baPath;
try {
baPath = connector.getMappingService().fromDataDom(domPath);
if (potentialConnector != null) {
return;
}
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = connector.getMappingService().toDataDom(baPath);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath = connector.getMappingService().toDataDom(baPath);
tryToDeployConnector(baPath, domPath);
}
// FIXME: Implement closeMountPoint
}
- public synchronized void undeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) {
+ public synchronized void undeployDomForwarder(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath) {
// FIXME: Implement closeMountPoint
}
private class DomMountPointForwardingManager implements MountProvisionListener {
@Override
- public void onMountPointCreated(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+ public void onMountPointCreated(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path) {
tryToDeployDomForwarder(path);
}
@Override
- public void onMountPointRemoved(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+ public void onMountPointRemoved(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path) {
undeployDomForwarder(path);
}
}
import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA =
NODES_INSTANCE_ID_BA.child(Node.class, NODE_KEY);
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier NODE_INSTANCE_ID_BI = //
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
.node(Nodes.QNAME) //
.nodeWithKey(Node.QNAME, NODE_KEY_BI) //
.toInstance();
return new AugmentationVerifier<Node>(readedNode);
}
- private void assertBindingIndependentVersion(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
+ private void assertBindingIndependentVersion(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier nodeId) {
CompositeNode node = biDataService.readOperationalData(nodeId);
assertNotNull(node);
}
@Beta
public class BindingTestContext implements AutoCloseable {
- public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier TREE_ROOT = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+ public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier TREE_ROOT = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
.builder().toInstance();
private static final Logger LOG = LoggerFactory.getLogger(BindingTestContext.class);
@SuppressWarnings("deprecation")
public class ListProcessingAndOrderingTest extends AbstractDataServiceTest {
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier DOM_UNORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_UNORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
.builder(Lists.QNAME).node(UnorderedContainer.QNAME).node(UnorderedList.QNAME).build();
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier DOM_ORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_ORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
.builder(Lists.QNAME).node(OrderedContainer.QNAME).node(OrderedList.QNAME).build();
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier DOM_UNKEYED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_UNKEYED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
.builder(Lists.QNAME).node(UnkeyedContainer.QNAME).node(UnkeyedList.QNAME).build();
private static final InstanceIdentifier<UnorderedContainer> UNORDERED_CONTAINER_PATH = InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).build();
}
private NormalizedNode<?, ?> resolveDataAsserted(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath) {
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath) {
try (DOMDataReadOnlyTransaction readTx = testContext.getDomAsyncDataBroker().newReadOnlyTransaction()){
ListenableFuture<Optional<NormalizedNode<?, ?>>> data = readTx.read(LogicalDatastoreType.OPERATIONAL, domPath);
private void assertXmlRepresentation(final InstanceIdentifier<?> containerPath, final String... childNameValues) {
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = testContext.getBindingToDomMappingService().toDataDom(containerPath);
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath = testContext.getBindingToDomMappingService().toDataDom(containerPath);
CompositeNode compositeNode = testContext.getDomDataBroker().readOperationalData(domPath);
assertNotNull(compositeNode);
}
private void verifyDataAreStoredProperly() {
- CompositeNode biFlows = biDataService.readConfigurationData(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.of(Flows.QNAME));
+ CompositeNode biFlows = biDataService.readConfigurationData(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.of(Flows.QNAME));
assertNotNull(biFlows);
CompositeNode biFlow = biFlows.getFirstCompositeByName(Flow.QNAME);
assertNotNull(biFlow);
.toInstance();
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier NODE_INSTANCE_ID_BI = //
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
.node(Nodes.QNAME) //
.nodeWithKey(Node.QNAME, NODE_KEY_BI) //
.toInstance();
private static final QName SUPPORTED_ACTIONS_QNAME = QName.create(FlowCapableNode.QNAME, SupportedActions.QNAME.getLocalName());
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier SUPPORTED_ACTIONS_INSTANCE_ID_BI = //
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier SUPPORTED_ACTIONS_INSTANCE_ID_BI = //
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
.node(Nodes.QNAME) //
.nodeWithKey(Node.QNAME, NODE_KEY_BI) //
.node(SUPPORTED_ACTIONS_QNAME) //
}
private void assertBindingIndependentVersion(
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier nodeId) {
CompositeNode node = biDataService.readOperationalData(nodeId);
assertNotNull(node);
}
FlowBuilder builder = new FlowBuilder()
.setKey(FLOW_KEY)
.addAugmentation(FlowStatisticsData.class,new FlowStatisticsDataBuilder()
- .setFlowStatistics(new FlowStatisticsBuilder()
- .setBarrier(true)
- .setMatch(new MatchBuilder()
- .build())
- .build())
+ .setFlowStatistics(new FlowStatisticsBuilder().build())
.build())
- ;//.build();
+ .setBarrier(true)
+ .setMatch(new MatchBuilder()
+ .build())
+ ;
return builder.build();
}
.augmentation(FlowCapableNode.class) //
.build();
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier NODE_INSTANCE_ID_BI = //
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
.node(Nodes.QNAME) //
.nodeWithKey(Node.QNAME, NODE_KEY_BI) //
.toInstance();
assertNull(node);
}
- private void assertBindingIndependentVersion(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
+ private void assertBindingIndependentVersion(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier nodeId) {
CompositeNode node = biDataService.readOperationalData(nodeId);
assertNotNull(node);
}
private static final Map<QName, Object> TABLE_KEY_BI = //
ImmutableMap.<QName, Object> of(TABLE_ID_QNAME, TABLE_ID);;
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier FLOW_INSTANCE_ID_BI = //
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier FLOW_INSTANCE_ID_BI = //
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
.node(Nodes.QNAME) //
.nodeWithKey(Node.QNAME, NODE_KEY_BI) //
.nodeWithKey(Table.QNAME, TABLE_KEY_BI) //
private static final QName AUGMENTED_GROUP_STATISTICS = QName.create(NodeGroupStatistics.QNAME,
GroupStatistics.QNAME.getLocalName());
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier NODE_INSTANCE_ID_BI = //
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
.node(Nodes.QNAME) //
.nodeWithKey(Node.QNAME, NODE_KEY_BI) //
.toInstance();
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier GROUP_STATISTICS_ID_BI = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier GROUP_STATISTICS_ID_BI = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
//
.builder(NODE_INSTANCE_ID_BI)
.nodeWithKey(QName.create(FlowCapableNode.QNAME, "group"), QName.create(FlowCapableNode.QNAME, "group-id"),
final BigInteger packetCount = BigInteger.valueOf(500L);
- DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> simpleReader = new DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode>() {
+ DataReader<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> simpleReader = new DataReader<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode>() {
@Override
- public CompositeNode readConfigurationData(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
+ public CompositeNode readConfigurationData(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier arg0) {
return null;
}
@Override
- public CompositeNode readOperationalData(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
+ public CompositeNode readOperationalData(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier arg0) {
if (arg0.equals(GROUP_STATISTICS_ID_BI)) {
ImmutableCompositeNode data = ImmutableCompositeNode
.builder()
public static final InstanceIdentifier<Node> BA_NODE_C_ID = createBANodeIdentifier(NODE_C);
public static final InstanceIdentifier<Node> BA_NODE_D_ID = createBANodeIdentifier(NODE_D);
- public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_A_ID = createBINodeIdentifier(NODE_A);
- public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_B_ID = createBINodeIdentifier(NODE_B);
- public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_C_ID = createBINodeIdentifier(NODE_C);
- public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_D_ID = createBINodeIdentifier(NODE_D);
+ public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_A_ID = createBINodeIdentifier(NODE_A);
+ public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_B_ID = createBINodeIdentifier(NODE_B);
+ public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_C_ID = createBINodeIdentifier(NODE_C);
+ public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_D_ID = createBINodeIdentifier(NODE_D);
return InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(node)).toInstance();
}
- private static org.opendaylight.yangtools.yang.data.api.InstanceIdentifier createBINodeIdentifier(NodeId node) {
- return org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder().node(Nodes.QNAME)
+ private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(NodeId node) {
+ return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder().node(Nodes.QNAME)
.nodeWithKey(Node.QNAME, NODE_ID_QNAME, node.getValue()).toInstance();
}
private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
private static final InstanceIdentifier<Node> BA_MOUNT_ID = createBANodeIdentifier(MOUNT_NODE);
- private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_MOUNT_ID = createBINodeIdentifier(MOUNT_NODE);
+ private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_MOUNT_ID = createBINodeIdentifier(MOUNT_NODE);
private BindingTestContext testContext;
private MountProvisionService domMountPointService;
schemaContext = mountSchemaContext;
}
- private static org.opendaylight.yangtools.yang.data.api.InstanceIdentifier createBINodeIdentifier(
+ private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(
final NodeId mountNode) {
- return org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+ return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
.builder().node(Nodes.QNAME)
.nodeWithKey(Node.QNAME, NODE_ID_QNAME, mountNode.getValue())
.toInstance();
import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
operation = DataNormalizationOperation.from(ctx);
}
- public InstanceIdentifier toNormalized(final InstanceIdentifier legacy) {
+ public YangInstanceIdentifier toNormalized(final YangInstanceIdentifier legacy) {
ImmutableList.Builder<PathArgument> normalizedArgs = ImmutableList.builder();
DataNormalizationOperation<?> currentOp = operation;
throw new IllegalArgumentException(String.format("Failed to normalize path %s", legacy), e);
}
- return InstanceIdentifier.create(normalizedArgs.build());
+ return YangInstanceIdentifier.create(normalizedArgs.build());
}
- public DataNormalizationOperation<?> getOperation(final InstanceIdentifier legacy) throws DataNormalizationException {
+ public DataNormalizationOperation<?> getOperation(final YangInstanceIdentifier legacy) throws DataNormalizationException {
DataNormalizationOperation<?> currentOp = operation;
Iterator<PathArgument> arguments = legacy.getPathArguments().iterator();
return currentOp;
}
- public Map.Entry<InstanceIdentifier, NormalizedNode<?, ?>> toNormalized(
- final Map.Entry<InstanceIdentifier, CompositeNode> legacy) {
+ public Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalized(
+ final Map.Entry<YangInstanceIdentifier, CompositeNode> legacy) {
return toNormalized(legacy.getKey(), legacy.getValue());
}
- public Map.Entry<InstanceIdentifier, NormalizedNode<?, ?>> toNormalized(final InstanceIdentifier legacyPath,
+ public Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalized(final YangInstanceIdentifier legacyPath,
final CompositeNode legacyData) {
- InstanceIdentifier normalizedPath = toNormalized(legacyPath);
+ YangInstanceIdentifier normalizedPath = toNormalized(legacyPath);
DataNormalizationOperation<?> currentOp = operation;
for (PathArgument arg : normalizedPath.getPathArguments()) {
Preconditions.checkArgument(currentOp != null,
"Instance Identifier %s does not reference correct schema Node.", normalizedPath);
- return new AbstractMap.SimpleEntry<InstanceIdentifier, NormalizedNode<?, ?>>(normalizedPath,
+ return new AbstractMap.SimpleEntry<YangInstanceIdentifier, NormalizedNode<?, ?>>(normalizedPath,
currentOp.normalize(legacyData));
}
- public InstanceIdentifier toLegacy(final InstanceIdentifier normalized) throws DataNormalizationException {
+ public YangInstanceIdentifier toLegacy(final YangInstanceIdentifier normalized) throws DataNormalizationException {
ImmutableList.Builder<PathArgument> legacyArgs = ImmutableList.builder();
DataNormalizationOperation<?> currentOp = operation;
for (PathArgument normalizedArg : normalized.getPathArguments()) {
legacyArgs.add(normalizedArg);
}
}
- return InstanceIdentifier.create(legacyArgs.build());
+ return YangInstanceIdentifier.create(legacyArgs.build());
}
- public CompositeNode toLegacy(final InstanceIdentifier normalizedPath, final NormalizedNode<?, ?> normalizedData) {
+ public CompositeNode toLegacy(final YangInstanceIdentifier normalizedPath, final NormalizedNode<?, ?> normalizedData) {
// Preconditions.checkArgument(normalizedData instanceof
// DataContainerNode<?>,"Node object %s, %s should be of type DataContainerNode",normalizedPath,normalizedData);
if (normalizedData instanceof DataContainerNode<?>) {
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
- static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
- static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME)
+ static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
+ static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME)
.build();
static final QName ONE_QNAME = QName.create(TEST_QNAME, "one");
static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
static final Short OUTER_LIST_ID = (short) 10;
- static final InstanceIdentifier OUTER_LIST_PATH_LEGACY = InstanceIdentifier.builder(TEST_QNAME)
+ static final YangInstanceIdentifier OUTER_LIST_PATH_LEGACY = YangInstanceIdentifier.builder(TEST_QNAME)
.nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID).build();
- static final InstanceIdentifier LEAF_TWO_PATH_LEGACY = InstanceIdentifier.builder(OUTER_LIST_PATH_LEGACY)
+ static final YangInstanceIdentifier LEAF_TWO_PATH_LEGACY = YangInstanceIdentifier.builder(OUTER_LIST_PATH_LEGACY)
.node(TWO_QNAME).build();
static final QName ANY_XML_LEAF_QNAME = QName.create(TEST_QNAME, "leaf");;
SchemaContext testCtx = createTestContext();
DataNormalizer normalizer = new DataNormalizer(testCtx);
- InstanceIdentifier normalizedPath = normalizer.toNormalized(LEAF_TWO_PATH_LEGACY);
+ YangInstanceIdentifier normalizedPath = normalizer.toNormalized(LEAF_TWO_PATH_LEGACY);
verifyNormalizedInstanceIdentifier(normalizedPath, TEST_QNAME, OUTER_LIST_QNAME, new Object[] {
OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID }, OUTER_CHOICE_QNAME, TWO_QNAME);
}
- private void verifyNormalizedInstanceIdentifier(final InstanceIdentifier actual, final Object... expPath) {
+ private void verifyNormalizedInstanceIdentifier(final YangInstanceIdentifier actual, final Object... expPath) {
assertNotNull("Actual InstanceIdentifier is null", actual);
assertEquals("InstanceIdentifier path length", expPath.length, Iterables.size(actual.getPathArguments()));
DataNormalizer normalizer = new DataNormalizer(createTestContext());
- InstanceIdentifier normalized = InstanceIdentifier.builder().node(TEST_QNAME).node(OUTER_LIST_QNAME)
+ YangInstanceIdentifier normalized = YangInstanceIdentifier.builder().node(TEST_QNAME).node(OUTER_LIST_QNAME)
.nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID).node(OUTER_CHOICE_QNAME).node(TWO_QNAME)
.build();
- InstanceIdentifier legacy = normalizer.toLegacy(normalized);
+ YangInstanceIdentifier legacy = normalizer.toLegacy(normalized);
assertEquals("Legacy InstanceIdentifier", LEAF_TWO_PATH_LEGACY, legacy);
}
.withNodeIdentifier(new NodeIdentifier(TEST_QNAME)).withChild(testAnyXmlNode).build();
DataNormalizer normalizer = new DataNormalizer(createTestContext());
- Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+ Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
verifyLegacyNode(
legacyNode,
DataNormalizer normalizer = new DataNormalizer(createTestContext());
- Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+ Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
verifyLegacyNode(
legacyNode,
DataNormalizer normalizer = new DataNormalizer(createTestContext());
- Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+ Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
verifyLegacyNode(
legacyNode,
testBuilder.add(unkeyedListBuilder.toInstance());
}
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
- .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(InstanceIdentifier.create(
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+ .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
CompositeNode anyXmlLegacy = anyXmlBuilder.toInstance();
testBuilder.add(anyXmlLegacy);
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
- .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(InstanceIdentifier.create(
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+ .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
testBuilder.add(outerContBuilder.toInstance());
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
- .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(InstanceIdentifier.create(
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+ .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
verifyNormalizedNode(normalizedNodeEntry.getValue(),
expectContainerNode(TEST_QNAME, expectContainerNode(OUTER_CONTAINER_QNAME, expAugmentation)));
- normalizedNodeEntry = normalizer.toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(
- InstanceIdentifier.create(Lists.newArrayList(new NodeIdentifier(TEST_QNAME), new NodeIdentifier(
+ normalizedNodeEntry = normalizer.toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(
+ YangInstanceIdentifier.create(Lists.newArrayList(new NodeIdentifier(TEST_QNAME), new NodeIdentifier(
OUTER_CONTAINER_QNAME))), outerContBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME, OUTER_CONTAINER_QNAME,
testBuilder.addLeaf(ORDERED_LEAF_LIST_QNAME, "ordered-value" + i);
}
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
- .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(InstanceIdentifier.create(
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+ .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
import org.opendaylight.controller.sal.core.api.RpcImplementation;
import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public interface Connector extends RpcImplementation, NotificationListener {
- Set<InstanceIdentifier> getConfigurationPrefixes();
- Set<InstanceIdentifier> getRuntimePrefixes();
+ Set<YangInstanceIdentifier> getConfigurationPrefixes();
+ Set<YangInstanceIdentifier> getRuntimePrefixes();
void registerListener(ConnectorListener listener);
void unregisterListener(ConnectorListener listener);
import java.util.Set;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public interface ConnectorListener {
- void onPrefixesAnnounced(Set<InstanceIdentifier> prefixes);
- void onPrefixesWithdrawn(Set<InstanceIdentifier> prefixes);
+ void onPrefixesAnnounced(Set<YangInstanceIdentifier> prefixes);
+ void onPrefixesWithdrawn(Set<YangInstanceIdentifier> prefixes);
}
<artifactId>scala-library</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-protocolbuffer-encoding</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-akka-raft</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </dependency>
+
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<Private-Package></Private-Package>
<Import-Package>!*snappy;!org.jboss.*;*</Import-Package>
<Embed-Dependency>
+ sal-protocolbuffer-encoding;
+ sal-akka-raft;
!sal*;
!*config-api*;
!*testkit*;
}
@Override public void onReceive(Object message) throws Exception {
- LOG.debug("Received message {}", message);
+ LOG.debug("Received message {}", message.getClass().getSimpleName());
handleReceive(message);
- LOG.debug("Done handling message {}", message);
+ LOG.debug("Done handling message {}", message.getClass().getSimpleName());
}
protected abstract void handleReceive(Object message) throws Exception;
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+
+public interface ClusterWrapper {
+ void subscribeToMemberEvents(ActorRef actorRef);
+ String getCurrentMemberName();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.cluster.Cluster;
+import akka.cluster.ClusterEvent;
+
+public class ClusterWrapperImpl implements ClusterWrapper {
+ private final Cluster cluster;
+ private final String currentMemberName;
+
+ public ClusterWrapperImpl(ActorSystem actorSystem){
+ cluster = Cluster.get(actorSystem);
+ currentMemberName = (String) cluster.getSelfRoles().toArray()[0];
+
+ }
+
+ public void subscribeToMemberEvents(ActorRef actorRef){
+ cluster.subscribe(actorRef, ClusterEvent.initialStateAsEvents(),
+ ClusterEvent.MemberEvent.class,
+ ClusterEvent.UnreachableMember.class);
+ }
+
+ public String getCurrentMemberName() {
+ return currentMemberName;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import com.google.common.base.Preconditions;
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CompositeModificationPayload extends Payload implements
+ Serializable {
+
+ private final PersistentMessages.CompositeModification modification;
+
+ public CompositeModificationPayload(){
+ modification = null;
+ }
+ public CompositeModificationPayload(Object modification){
+ this.modification = (PersistentMessages.CompositeModification) modification;
+ }
+
+ @Override public Map<GeneratedMessage.GeneratedExtension, PersistentMessages.CompositeModification> encode() {
+ Preconditions.checkState(modification!=null);
+ Map<GeneratedMessage.GeneratedExtension, PersistentMessages.CompositeModification> map = new HashMap<>();
+ map.put(org.opendaylight.controller.mdsal.CompositeModificationPayload.modification, this.modification);
+ return map;
+ }
+
+ @Override public Payload decode(
+ AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payload) {
+ PersistentMessages.CompositeModification modification = payload
+ .getExtension(
+ org.opendaylight.controller.mdsal.CompositeModificationPayload.modification);
+ payload.getExtension(KeyValueMessages.value);
+ return new CompositeModificationPayload(modification);
+ }
+
+ public Object getModification(){
+ return this.modification;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
+
+import java.util.List;
+import java.util.Map;
+
+public interface Configuration {
+
+ /**
+ * Given a memberName find all the shards that belong on that member and
+ * return the names of those shards
+ *
+ * @param memberName
+ * @return
+ */
+ List<String> getMemberShardNames(String memberName);
+
+ /**
+ * Given a module namespace return the name of a module
+ * @param nameSpace
+ * @return
+ */
+ Optional<String> getModuleNameFromNameSpace(String nameSpace);
+
+ /**
+ * Get a mapping of the module names to it's corresponding ShardStrategy
+ * @return
+ */
+ Map<String, ShardStrategy> getModuleNameToShardStrategyMap();
+
+ /**
+ * Given a module name find all the shardNames corresponding to it
+ * @param moduleName
+ * @return
+ */
+ List<String> getShardNamesFromModuleName(String moduleName);
+
+ /**
+ * Given a shardName find all the members on which it belongs
+ *
+ * @param shardName
+ * @return
+ */
+ List<String> getMembersFromShardName(String shardName);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import com.google.common.base.Optional;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import com.typesafe.config.ConfigObject;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.DefaultShardStrategy;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ModuleShardStrategy;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ConfigurationImpl implements Configuration {
+
+ private final List<ModuleShard> moduleShards = new ArrayList<>();
+
+ private final List<Module> modules = new ArrayList<>();
+
+ private static final Logger
+ LOG = LoggerFactory.getLogger(DistributedDataStore.class);
+
+
+ public ConfigurationImpl(String moduleShardsConfigPath,
+
+ String modulesConfigPath){
+
+ File moduleShardsFile = new File("./configuration/initial/" + moduleShardsConfigPath);
+ File modulesFile = new File("./configuration/initial/" + modulesConfigPath);
+
+ Config moduleShardsConfig = null;
+ if(moduleShardsFile.exists()) {
+ LOG.info("module shards config file exists - reading config from it");
+ moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile);
+ } else {
+ LOG.warn("module shards configuration read from resource");
+ moduleShardsConfig = ConfigFactory.load(moduleShardsConfigPath);
+ }
+
+ Config modulesConfig = null;
+ if(modulesFile.exists()) {
+ LOG.info("modules config file exists - reading config from it");
+ modulesConfig = ConfigFactory.parseFile(modulesFile);
+ } else {
+ LOG.warn("modules configuration read from resource");
+ modulesConfig = ConfigFactory.load(modulesConfigPath);
+ }
+
+ readModuleShards(moduleShardsConfig);
+
+ readModules(modulesConfig);
+ }
+
+ @Override public List<String> getMemberShardNames(String memberName){
+ List<String> shards = new ArrayList();
+ for(ModuleShard ms : moduleShards){
+ for(Shard s : ms.getShards()){
+ for(String m : s.getReplicas()){
+ if(memberName.equals(m)){
+ shards.add(s.getName());
+ }
+ }
+ }
+ }
+ return shards;
+
+ }
+
+ @Override public Optional<String> getModuleNameFromNameSpace(String nameSpace) {
+ for(Module m : modules){
+ if(m.getNameSpace().equals(nameSpace)){
+ return Optional.of(m.getName());
+ }
+ }
+ return Optional.absent();
+ }
+
+ @Override public Map<String, ShardStrategy> getModuleNameToShardStrategyMap() {
+ Map<String, ShardStrategy> map = new HashMap<>();
+ for(Module m : modules){
+ map.put(m.getName(), m.getShardStrategy());
+ }
+ return map;
+ }
+
+ @Override public List<String> getShardNamesFromModuleName(String moduleName) {
+ for(ModuleShard m : moduleShards){
+ if(m.getModuleName().equals(moduleName)){
+ List<String> l = new ArrayList<>();
+ for(Shard s : m.getShards()){
+ l.add(s.getName());
+ }
+ return l;
+ }
+ }
+
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override public List<String> getMembersFromShardName(String shardName) {
+ List<String> shards = new ArrayList();
+ for(ModuleShard ms : moduleShards){
+ for(Shard s : ms.getShards()) {
+ if(s.getName().equals(shardName)){
+ return s.getReplicas();
+ }
+ }
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+
+
+ private void readModules(Config modulesConfig) {
+ List<? extends ConfigObject> modulesConfigObjectList =
+ modulesConfig.getObjectList("modules");
+
+ for(ConfigObject o : modulesConfigObjectList){
+ ConfigObjectWrapper w = new ConfigObjectWrapper(o);
+ modules.add(new Module(w.stringValue("name"), w.stringValue(
+ "namespace"), w.stringValue("shard-strategy")));
+ }
+ }
+
+ private void readModuleShards(Config moduleShardsConfig) {
+ List<? extends ConfigObject> moduleShardsConfigObjectList =
+ moduleShardsConfig.getObjectList("module-shards");
+
+ for(ConfigObject moduleShardConfigObject : moduleShardsConfigObjectList){
+
+ String moduleName = moduleShardConfigObject.get("name").unwrapped().toString();
+
+ List<? extends ConfigObject> shardsConfigObjectList =
+ moduleShardConfigObject.toConfig().getObjectList("shards");
+
+ List<Shard> shards = new ArrayList<>();
+
+ for(ConfigObject shard : shardsConfigObjectList){
+ String shardName = shard.get("name").unwrapped().toString();
+ List<String> replicas = shard.toConfig().getStringList("replicas");
+ shards.add(new Shard(shardName, replicas));
+ }
+
+ this.moduleShards.add(new ModuleShard(moduleName, shards));
+ }
+ }
+
+
+ private class ModuleShard {
+ private final String moduleName;
+ private final List<Shard> shards;
+
+ public ModuleShard(String moduleName, List<Shard> shards) {
+ this.moduleName = moduleName;
+ this.shards = shards;
+ }
+
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ public List<Shard> getShards() {
+ return shards;
+ }
+ }
+
+ private class Shard {
+ private final String name;
+ private final List<String> replicas;
+
+ Shard(String name, List<String> replicas) {
+ this.name = name;
+ this.replicas = replicas;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List<String> getReplicas() {
+ return replicas;
+ }
+ }
+
+ private class Module {
+
+ private final String name;
+ private final String nameSpace;
+ private final ShardStrategy shardStrategy;
+
+ Module(String name, String nameSpace, String shardStrategy) {
+ this.name = name;
+ this.nameSpace = nameSpace;
+ if(ModuleShardStrategy.NAME.equals(shardStrategy)){
+ this.shardStrategy = new ModuleShardStrategy(name, ConfigurationImpl.this);
+ } else {
+ this.shardStrategy = new DefaultShardStrategy();
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getNameSpace() {
+ return nameSpace;
+ }
+
+ public ShardStrategy getShardStrategy() {
+ return shardStrategy;
+ }
+ }
+
+
+ private static class ConfigObjectWrapper{
+
+ private final ConfigObject configObject;
+
+ ConfigObjectWrapper(ConfigObject configObject){
+ this.configObject = configObject;
+ }
+
+ public String stringValue(String name){
+ return configObject.get(name).unwrapped().toString();
+ }
+ }
+}
import org.opendaylight.controller.cluster.datastore.messages.DataChangedReply;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class DataChangeListener extends AbstractUntypedActor {
- private final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener;
+ private final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener;
+ private final SchemaContext schemaContext;
+ private final YangInstanceIdentifier pathId;
- public DataChangeListener(
- AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener) {
+ public DataChangeListener(SchemaContext schemaContext,
+ AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener, YangInstanceIdentifier pathId) {
this.listener = listener;
+ this.schemaContext = schemaContext;
+ this.pathId = pathId;
}
@Override public void handleReceive(Object message) throws Exception {
- if(message instanceof DataChanged){
- DataChanged reply = (DataChanged) message;
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>
+ if(message.getClass().equals(DataChanged.SERIALIZABLE_CLASS)){
+ DataChanged reply = DataChanged.fromSerialize(schemaContext,message, pathId);
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>
change = reply.getChange();
this.listener.onDataChanged(change);
if(getSender() != null){
- getSender().tell(new DataChangedReply(), getSelf());
+ getSender().tell(new DataChangedReply().toSerializable(), getSelf());
}
}
}
- public static Props props(final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener) {
+ public static Props props(final SchemaContext schemaContext, final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener, final YangInstanceIdentifier pathId) {
return Props.create(new Creator<DataChangeListener>() {
@Override
public DataChangeListener create() throws Exception {
- return new DataChangeListener(listener);
+ return new DataChangeListener(schemaContext,listener,pathId );
}
});
import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
/**
* DataChangeListenerProxy represents a single remote DataChangeListener
*/
-public class DataChangeListenerProxy implements AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>{
+public class DataChangeListenerProxy implements AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>{
private final ActorSelection dataChangeListenerActor;
+ private final SchemaContext schemaContext;
- public DataChangeListenerProxy(ActorSelection dataChangeListenerActor) {
+ public DataChangeListenerProxy(SchemaContext schemaContext,ActorSelection dataChangeListenerActor) {
this.dataChangeListenerActor = dataChangeListenerActor;
+ this.schemaContext = schemaContext;
}
@Override public void onDataChanged(
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
- dataChangeListenerActor.tell(new DataChanged(change), null);
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
+ dataChangeListenerActor.tell(new DataChanged(schemaContext,change).toSerializable(), null);
}
}
import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration;
import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistrationReply;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public class DataChangeListenerRegistration extends AbstractUntypedActor {
- private final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
+ private final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
registration;
public DataChangeListenerRegistration(
- org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+ org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
this.registration = registration;
}
@Override
public void handleReceive(Object message) throws Exception {
- if (message instanceof CloseDataChangeListenerRegistration) {
+ if (message.getClass().equals(CloseDataChangeListenerRegistration.SERIALIZABLE_CLASS)) {
closeListenerRegistration(
- (CloseDataChangeListenerRegistration) message);
+ new CloseDataChangeListenerRegistration());
}
}
public static Props props(
- final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+ final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
return Props.create(new Creator<DataChangeListenerRegistration>() {
@Override
CloseDataChangeListenerRegistration message) {
registration.close();
getSender()
- .tell(new CloseDataChangeListenerRegistrationReply(), getSelf());
+ .tell(new CloseDataChangeListenerRegistrationReply().toSerializable(), getSelf());
getSelf().tell(PoisonPill.getInstance(), getSelf());
}
}
import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
private final AsyncDataChangeListener listener;
private final ActorRef dataChangeListenerActor;
- public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
+ public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
DataChangeListenerRegistrationProxy(
ActorSelection listenerRegistrationActor,
L listener, ActorRef dataChangeListenerActor) {
@Override
public void close() {
- listenerRegistrationActor.tell(new CloseDataChangeListenerRegistration(), null);
+ listenerRegistrationActor.tell(new CloseDataChangeListenerRegistration().toSerializable(), null);
dataChangeListenerActor.tell(PoisonPill.getInstance(), null);
}
}
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
private final String type;
private final ActorContext actorContext;
+ private SchemaContext schemaContext;
+
+
/**
* Executor used to run FutureTask's
private final ExecutorService executor =
Executors.newFixedThreadPool(10);
- public DistributedDataStore(ActorSystem actorSystem, String type) {
- this(new ActorContext(actorSystem, actorSystem.actorOf(ShardManager.props(type), "shardmanager-" + type)), type);
+ public DistributedDataStore(ActorSystem actorSystem, String type, ClusterWrapper cluster, Configuration configuration) {
+ this(new ActorContext(actorSystem, actorSystem
+ .actorOf(ShardManager.props(type, cluster, configuration),
+ "shardmanager-" + type), cluster, configuration), type);
}
public DistributedDataStore(ActorContext actorContext, String type) {
@Override
- public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
- InstanceIdentifier path, L listener,
+ public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
+ YangInstanceIdentifier path, L listener,
AsyncDataBroker.DataChangeScope scope) {
ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf(
- DataChangeListener.props(listener));
+ DataChangeListener.props(schemaContext,listener,path ));
+
+ String shardName = ShardStrategyFactory.getStrategy(path).findShard(path);
- Object result = actorContext.executeShardOperation(Shard.DEFAULT_NAME,
+ Object result = actorContext.executeShardOperation(shardName,
new RegisterChangeListener(path, dataChangeListenerActor.path(),
- AsyncDataBroker.DataChangeScope.BASE),
+ scope).toSerializable(),
ActorContext.ASK_DURATION
);
- RegisterChangeListenerReply reply = (RegisterChangeListenerReply) result;
+ RegisterChangeListenerReply reply = RegisterChangeListenerReply.fromSerializable(actorContext.getActorSystem(),result);
return new DataChangeListenerRegistrationProxy(actorContext.actorSelection(reply.getListenerRegistrationPath()), listener, dataChangeListenerActor);
}
@Override
public DOMStoreTransactionChain createTransactionChain() {
- return new TransactionChainProxy(actorContext, executor);
+ return new TransactionChainProxy(actorContext, executor, schemaContext);
}
@Override
public DOMStoreReadTransaction newReadOnlyTransaction() {
return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY,
- executor);
+ executor, schemaContext);
}
@Override
public DOMStoreWriteTransaction newWriteOnlyTransaction() {
return new TransactionProxy(actorContext, TransactionProxy.TransactionType.WRITE_ONLY,
- executor);
+ executor, schemaContext);
}
@Override
public DOMStoreReadWriteTransaction newReadWriteTransaction() {
return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_WRITE,
- executor);
+ executor, schemaContext);
}
@Override public void onGlobalContextUpdated(SchemaContext schemaContext) {
+ this.schemaContext = schemaContext;
actorContext.getShardManager().tell(
new UpdateSchemaContext(schemaContext), null);
}
package org.opendaylight.controller.cluster.datastore;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
public class DistributedDataStoreFactory {
public static DistributedDataStore createInstance(String name, SchemaService schemaService){
+ ActorSystem actorSystem = ActorSystemFactory.getInstance();
+ Configuration config = new ConfigurationImpl("module-shards.conf", "modules.conf");
final DistributedDataStore dataStore =
- new DistributedDataStore(ActorSystemFactory.getInstance(), name);
+ new DistributedDataStore(actorSystem, name, new ClusterWrapperImpl(actorSystem),config );
+ ShardStrategyFactory.setConfiguration(config);
schemaService
.registerSchemaServiceListener(dataStore);
return dataStore;
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.UntypedActor;
+import org.opendaylight.controller.cluster.datastore.messages.AbortTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransactionReply;
+
+public class NoOpCohort extends UntypedActor {
+
+ @Override public void onReceive(Object message) throws Exception {
+ if (message.getClass().equals(CanCommitTransaction.SERIALIZABLE_CLASS)) {
+ getSender().tell(new CanCommitTransactionReply(false).toSerializable(), getSelf());
+ } else if (message.getClass().equals(PreCommitTransaction.SERIALIZABLE_CLASS)) {
+ getSender().tell(
+ new PreCommitTransactionReply().toSerializable(),
+ getSelf());
+ } else if (message.getClass().equals(CommitTransaction.SERIALIZABLE_CLASS)) {
+ getSender().tell(new CommitTransactionReply().toSerializable(), getSelf());
+ } else if (message.getClass().equals(AbortTransaction.SERIALIZABLE_CLASS)) {
+ getSender().tell(new AbortTransactionReply().toSerializable(), getSelf());
+ } else {
+ throw new Exception ("Not recognized message received,message="+message);
+ }
+
+ }
+}
+
import akka.event.Logging;
import akka.event.LoggingAdapter;
import akka.japi.Creator;
-import akka.persistence.Persistent;
-import akka.persistence.UntypedProcessor;
+import akka.serialization.Serialization;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardMBeanFactory;
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.ForwardedCommitTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.NonPersistent;
+import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
import org.opendaylight.controller.cluster.datastore.modification.Modification;
+import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification;
+import org.opendaylight.controller.cluster.raft.RaftActor;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import java.util.HashMap;
import java.util.Map;
* Our Shard uses InMemoryDataStore as it's internal representation and delegates all requests it
* </p>
*/
-public class Shard extends UntypedProcessor {
+public class Shard extends RaftActor {
public static final String DEFAULT_NAME = "default";
private final InMemoryDOMDataStore store;
- private final Map<Modification, DOMStoreThreePhaseCommitCohort>
+ private final Map<Object, DOMStoreThreePhaseCommitCohort>
modificationToCohort = new HashMap<>();
- private final LoggingAdapter log =
+ private final LoggingAdapter LOG =
Logging.getLogger(getContext().system(), this);
// By default persistent will be true and can be turned off using the system
// property persistent
private final boolean persistent;
- private Shard(String name) {
+ private final String name;
+
+ private SchemaContext schemaContext;
+
+ private final ShardStats shardMBean;
+
+ private Shard(String name, Map<String, String> peerAddresses) {
+ super(name, peerAddresses);
+
+ this.name = name;
String setting = System.getProperty("shard.persistent");
+
this.persistent = !"false".equals(setting);
- log.info("Creating shard : {} persistent : {}", name , persistent);
+ LOG.info("Creating shard : {} persistent : {}", name, persistent);
store = new InMemoryDOMDataStore(name, storeExecutor);
+
+ shardMBean = ShardMBeanFactory.getShardStatsMBean(name);
+
}
- public static Props props(final String name) {
+ public static Props props(final String name, final Map<String, String> peerAddresses) {
return Props.create(new Creator<Shard>() {
@Override
public Shard create() throws Exception {
- return new Shard(name);
+ return new Shard(name, peerAddresses);
}
});
}
- @Override
- public void onReceive(Object message) throws Exception {
- log.debug("Received message {}", message);
+ @Override public void onReceiveCommand(Object message){
+ LOG.debug("Received message {} from {}", message.getClass().toString(), getSender());
- if (message instanceof CreateTransactionChain) {
- createTransactionChain();
- } else if (message instanceof RegisterChangeListener) {
- registerChangeListener((RegisterChangeListener) message);
+ if (message.getClass().equals(CreateTransactionChain.SERIALIZABLE_CLASS)) {
+ if(isLeader()) {
+ createTransactionChain();
+ } else if(getLeader() != null){
+ getLeader().forward(message, getContext());
+ }
+ } else if (message.getClass().equals(RegisterChangeListener.SERIALIZABLE_CLASS)) {
+ registerChangeListener(RegisterChangeListener.fromSerializable(getContext().system(), message));
} else if (message instanceof UpdateSchemaContext) {
updateSchemaContext((UpdateSchemaContext) message);
} else if (message instanceof ForwardedCommitTransaction) {
handleForwardedCommit((ForwardedCommitTransaction) message);
- } else if (message instanceof Persistent) {
- commit((Modification) ((Persistent) message).payload());
- } else if (message instanceof CreateTransaction) {
- createTransaction((CreateTransaction) message);
- } else if(message instanceof NonPersistent){
- commit((Modification) ((NonPersistent) message).payload());
+ } else if (message.getClass().equals(CreateTransaction.SERIALIZABLE_CLASS)) {
+ if(isLeader()) {
+ createTransaction(CreateTransaction.fromSerializable(message));
+ } else if(getLeader() != null){
+ getLeader().forward(message, getContext());
+ }
+ } else if (message instanceof PeerAddressResolved){
+ PeerAddressResolved resolved = (PeerAddressResolved) message;
+ setPeerAddress(resolved.getPeerId(), resolved.getPeerAddress());
+ } else {
+ super.onReceiveCommand(message);
}
}
private void createTransaction(CreateTransaction createTransaction) {
DOMStoreReadWriteTransaction transaction =
store.newReadWriteTransaction();
+ String transactionId = "shard-" + createTransaction.getTransactionId();
+ LOG.info("Creating transaction : {} " , transactionId);
ActorRef transactionActor = getContext().actorOf(
- ShardTransaction.props(transaction, getSelf()), "shard-" + createTransaction.getTransactionId());
+ ShardTransaction.props(transaction, getSelf(), schemaContext), transactionId);
+
getSender()
- .tell(new CreateTransactionReply(transactionActor.path(), createTransaction.getTransactionId()),
+ .tell(new CreateTransactionReply(Serialization.serializedActorPath(transactionActor), createTransaction.getTransactionId()).toSerializable(),
getSelf());
}
- private void commit(Modification modification) {
+ private void commit(final ActorRef sender, Object serialized) {
+ Modification modification = MutableCompositeModification.fromSerializable(serialized, schemaContext);
DOMStoreThreePhaseCommitCohort cohort =
- modificationToCohort.remove(modification);
+ modificationToCohort.remove(serialized);
if (cohort == null) {
- log.error(
+ LOG.error(
"Could not find cohort for modification : " + modification);
+ LOG.info("Writing modification using a new transaction");
+ modification.apply(store.newReadWriteTransaction());
return;
}
+
final ListenableFuture<Void> future = cohort.commit();
- final ActorRef sender = getSender();
+ shardMBean.incrementCommittedTransactionCount();
final ActorRef self = getSelf();
future.addListener(new Runnable() {
@Override
public void run() {
try {
future.get();
- sender.tell(new CommitTransactionReply(), self);
+
+ if(sender != null) {
+ sender
+ .tell(new CommitTransactionReply().toSerializable(),
+ self);
+ } else {
+ LOG.error("sender is null ???");
+ }
} catch (InterruptedException | ExecutionException e) {
// FIXME : Handle this properly
- log.error(e, "An exception happened when committing");
+ LOG.error(e, "An exception happened when committing");
}
}
}, getContext().dispatcher());
}
private void handleForwardedCommit(ForwardedCommitTransaction message) {
+ Object serializedModification = message.getModification().toSerializable();
+
modificationToCohort
- .put(message.getModification(), message.getCohort());
+ .put(serializedModification , message.getCohort());
+
if(persistent) {
- getSelf().forward(Persistent.create(message.getModification()),
- getContext());
+ this.persistData(getSender(), "identifier", new CompositeModificationPayload(serializedModification));
} else {
- getSelf().forward(NonPersistent.create(message.getModification()),
- getContext());
+ this.commit(getSender(), serializedModification);
}
}
private void updateSchemaContext(UpdateSchemaContext message) {
+ this.schemaContext = message.getSchemaContext();
store.onGlobalContextUpdated(message.getSchemaContext());
}
private void registerChangeListener(
RegisterChangeListener registerChangeListener) {
+ LOG.debug("registerDataChangeListener for " + registerChangeListener.getPath());
+
+
ActorSelection dataChangeListenerPath = getContext()
- .system().actorSelection(registerChangeListener.getDataChangeListenerPath());
+ .system().actorSelection(
+ registerChangeListener.getDataChangeListenerPath());
- AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>
- listener = new DataChangeListenerProxy(dataChangeListenerPath);
+ AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>
+ listener = new DataChangeListenerProxy(schemaContext,dataChangeListenerPath);
- org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
+ org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
registration =
store.registerChangeListener(registerChangeListener.getPath(),
listener, registerChangeListener.getScope());
ActorRef listenerRegistration =
getContext().actorOf(
DataChangeListenerRegistration.props(registration));
+
+ LOG.debug("registerDataChangeListener sending reply, listenerRegistrationPath = " + listenerRegistration.path().toString());
+
getSender()
- .tell(new RegisterChangeListenerReply(listenerRegistration.path()),
+ .tell(new RegisterChangeListenerReply(listenerRegistration.path()).toSerializable(),
getSelf());
}
private void createTransactionChain() {
DOMStoreTransactionChain chain = store.createTransactionChain();
ActorRef transactionChain =
- getContext().actorOf(ShardTransactionChain.props(chain));
+ getContext().actorOf(
+ ShardTransactionChain.props(chain, schemaContext));
getSender()
- .tell(new CreateTransactionChainReply(transactionChain.path()),
+ .tell(new CreateTransactionChainReply(transactionChain.path())
+ .toSerializable(),
getSelf());
}
+
+ @Override protected void applyState(ActorRef clientActor, String identifier,
+ Object data) {
+
+ if(data instanceof CompositeModificationPayload){
+ Object modification =
+ ((CompositeModificationPayload) data).getModification();
+ commit(clientActor, modification);
+ } else {
+ LOG.error("Unknown state received {}", data);
+ }
+
+ }
+
+ @Override protected Object createSnapshot() {
+ throw new UnsupportedOperationException("createSnapshot");
+ }
+
+ @Override protected void applySnapshot(Object snapshot) {
+ throw new UnsupportedOperationException("applySnapshot");
+ }
+
+ @Override public String persistenceId() {
+ return this.name;
+ }
}
import akka.actor.ActorPath;
import akka.actor.ActorRef;
import akka.actor.Address;
+import akka.actor.OneForOneStrategy;
import akka.actor.Props;
-import akka.event.Logging;
-import akka.event.LoggingAdapter;
+import akka.actor.SupervisorStrategy;
+import akka.cluster.ClusterEvent;
import akka.japi.Creator;
+import akka.japi.Function;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
+import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound;
import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
+import scala.concurrent.duration.Duration;
import java.util.HashMap;
import java.util.List;
*/
public class ShardManager extends AbstractUntypedActor {
- // Stores a mapping between a shard name and the address of the current primary
- private final Map<String, Address> shardNameToPrimaryAddress = new HashMap<>();
-
- // Stores a mapping between a member name and the address of the member
- private final Map<String, Address> memberNameToAddress = new HashMap<>();
-
- // Stores a mapping between the shard name and all the members on which a replica of that shard are available
- private final Map<String, List<String>> shardNameToMembers = new HashMap<>();
-
- private final LoggingAdapter log = Logging.getLogger(getContext().system(), this);
-
- private final ActorPath defaultShardPath;
-
- /**
- *
- * @param type defines the kind of data that goes into shards created by this shard manager. Examples of type would be
- * configuration or operational
- */
- private ShardManager(String type){
- ActorRef actor = getContext().actorOf(Shard.props("shard-" + Shard.DEFAULT_NAME + "-" + type), "shard-" + Shard.DEFAULT_NAME + "-" + type);
- defaultShardPath = actor.path();
- }
-
- public static Props props(final String type){
- return Props.create(new Creator<ShardManager>(){
-
- @Override
- public ShardManager create() throws Exception {
- return new ShardManager(type);
- }
- });
- }
-
- @Override
- public void handleReceive(Object message) throws Exception {
- if (message instanceof FindPrimary) {
- FindPrimary msg = ((FindPrimary) message);
- String shardName = msg.getShardName();
- if(Shard.DEFAULT_NAME.equals(shardName)){
- getSender().tell(new PrimaryFound(defaultShardPath.toString()), getSelf());
- } else {
- getSender().tell(new PrimaryNotFound(shardName), getSelf());
- }
- } else if(message instanceof UpdateSchemaContext){
- // FIXME : Notify all local shards of a context change
- getContext().system().actorSelection(defaultShardPath).forward(message, getContext());
+ // Stores a mapping between a member name and the address of the member
+ private final Map<String, Address> memberNameToAddress = new HashMap<>();
+
+ private final Map<String, ShardInformation> localShards = new HashMap<>();
+
+
+ private final String type;
+
+ private final ClusterWrapper cluster;
+
+ private final Configuration configuration;
+
+ /**
+ * @param type defines the kind of data that goes into shards created by this shard manager. Examples of type would be
+ * configuration or operational
+ */
+ private ShardManager(String type, ClusterWrapper cluster, Configuration configuration) {
+
+ this.type = Preconditions.checkNotNull(type, "type should not be null");
+ this.cluster = Preconditions.checkNotNull(cluster, "cluster should not be null");
+ this.configuration = Preconditions.checkNotNull(configuration, "configuration should not be null");
+
+ // Subscribe this actor to cluster member events
+ cluster.subscribeToMemberEvents(getSelf());
+
+ // Create all the local Shards and make them a child of the ShardManager
+ // TODO: This may need to be initiated when we first get the schema context
+ createLocalShards();
+ }
+
+ public static Props props(final String type,
+ final ClusterWrapper cluster,
+ final Configuration configuration) {
+ return Props.create(new Creator<ShardManager>() {
+
+ @Override
+ public ShardManager create() throws Exception {
+ return new ShardManager(type, cluster, configuration);
+ }
+ });
+ }
+
+
+ @Override
+ public void handleReceive(Object message) throws Exception {
+ if (message.getClass().equals(FindPrimary.SERIALIZABLE_CLASS)) {
+ findPrimary(
+ FindPrimary.fromSerializable(message));
+
+ } else if (message instanceof UpdateSchemaContext) {
+ updateSchemaContext(message);
+ } else if (message instanceof ClusterEvent.MemberUp){
+ memberUp((ClusterEvent.MemberUp) message);
+ } else if(message instanceof ClusterEvent.MemberRemoved) {
+ memberRemoved((ClusterEvent.MemberRemoved) message);
+ } else if(message instanceof ClusterEvent.UnreachableMember) {
+ ignoreMessage(message);
+ } else{
+ throw new Exception ("Not recognized message received, message="+message);
+ }
+
+ }
+
+ private void ignoreMessage(Object message){
+ LOG.debug("Unhandled message : " + message);
+ }
+
+ private void memberRemoved(ClusterEvent.MemberRemoved message) {
+ memberNameToAddress.remove(message.member().roles().head());
+ }
+
+ private void memberUp(ClusterEvent.MemberUp message) {
+ String memberName = message.member().roles().head();
+
+ memberNameToAddress.put(memberName , message.member().address());
+
+ for(ShardInformation info : localShards.values()){
+ String shardName = info.getShardName();
+ info.updatePeerAddress(getShardActorName(memberName, shardName),
+ getShardActorPath(shardName, memberName));
+ }
+ }
+
+ private void updateSchemaContext(Object message) {
+ for(ShardInformation info : localShards.values()){
+ info.getActor().tell(message,getSelf());
+ }
+ }
+
+ private void findPrimary(FindPrimary message) {
+ String shardName = message.getShardName();
+
+ List<String> members =
+ configuration.getMembersFromShardName(shardName);
+
+ // First see if the there is a local replica for the shard
+ ShardInformation info = localShards.get(shardName);
+ if(info != null) {
+ ActorPath shardPath = info.getActorPath();
+ if (shardPath != null) {
+ getSender()
+ .tell(
+ new PrimaryFound(shardPath.toString()).toSerializable(),
+ getSelf());
+ return;
+ }
+ }
+
+ if(cluster.getCurrentMemberName() != null) {
+ members.remove(cluster.getCurrentMemberName());
+ }
+
+ // There is no way for us to figure out the primary (for now) so assume
+ // that one of the remote nodes is a primary
+ for(String memberName : members) {
+ Address address = memberNameToAddress.get(memberName);
+ if(address != null){
+ String path =
+ getShardActorPath(shardName, memberName);
+ getSender().tell(new PrimaryFound(path).toSerializable(), getSelf());
+ return;
+ }
+ }
+ getSender().tell(new PrimaryNotFound(shardName).toSerializable(), getSelf());
+ }
+
+ private String
+
+
+ getShardActorPath(String shardName, String memberName) {
+ Address address = memberNameToAddress.get(memberName);
+ if(address != null) {
+ return address.toString() + "/user/shardmanager-" + this.type + "/"
+ + getShardActorName(
+ memberName, shardName);
+ }
+ return null;
+ }
+
+ private String getShardActorName(String memberName, String shardName){
+ return memberName + "-shard-" + shardName + "-" + this.type;
}
- }
+ // Create the shards that are local to this member
+ private void createLocalShards() {
+ String memberName = this.cluster.getCurrentMemberName();
+ List<String> memberShardNames =
+ this.configuration.getMemberShardNames(memberName);
+ for(String shardName : memberShardNames){
+ String shardActorName = getShardActorName(memberName, shardName);
+ Map<String, String> peerAddresses = getPeerAddresses(shardName);
+ ActorRef actor = getContext()
+ .actorOf(Shard.props(shardActorName, peerAddresses),
+ shardActorName);
+ localShards.put(shardName, new ShardInformation(shardName, actor, peerAddresses));
+ }
+
+ }
+
+ private Map<String, String> getPeerAddresses(String shardName){
+
+ Map<String, String> peerAddresses = new HashMap<>();
+
+ List<String> members =
+ this.configuration.getMembersFromShardName(shardName);
+
+ String currentMemberName = this.cluster.getCurrentMemberName();
+
+ for(String memberName : members){
+ if(!currentMemberName.equals(memberName)){
+ String shardActorName = getShardActorName(memberName, shardName);
+ String path =
+ getShardActorPath(shardName, currentMemberName);
+ peerAddresses.put(shardActorName, path);
+ }
+ }
+ return peerAddresses;
+ }
+
+
+ @Override
+ public SupervisorStrategy supervisorStrategy() {
+ return new OneForOneStrategy(10, Duration.create("1 minute"),
+ new Function<Throwable, SupervisorStrategy.Directive>() {
+ @Override
+ public SupervisorStrategy.Directive apply(Throwable t) {
+ return SupervisorStrategy.resume();
+ }
+ }
+ );
+
+ }
+
+ private class ShardInformation {
+ private final String shardName;
+ private final ActorRef actor;
+ private final ActorPath actorPath;
+ private final Map<String, String> peerAddresses;
+
+ private ShardInformation(String shardName, ActorRef actor,
+ Map<String, String> peerAddresses) {
+ this.shardName = shardName;
+ this.actor = actor;
+ this.actorPath = actor.path();
+ this.peerAddresses = peerAddresses;
+ }
+
+ public String getShardName() {
+ return shardName;
+ }
+
+ public ActorRef getActor(){
+ return actor;
+ }
+
+ public ActorPath getActorPath() {
+ return actorPath;
+ }
+
+ public Map<String, String> getPeerAddresses() {
+ return peerAddresses;
+ }
+
+ public void updatePeerAddress(String peerId, String peerAddress){
+ LOG.info("updatePeerAddress for peer {} with address {}", peerId, peerAddress);
+ if(peerAddresses.containsKey(peerId)){
+ peerAddresses.put(peerId, peerAddress);
+
+ LOG.info("Sending PeerAddressResolved for peer {} with address {} to {}", peerId, peerAddress, actor.path());
+
+ actor
+ .tell(new PeerAddressResolved(peerId, peerAddress),
+ getSelf());
+
+ }
+ }
+ }
}
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import java.util.concurrent.ExecutionException;
public class ShardTransaction extends AbstractUntypedActor {
private final ActorRef shardActor;
+ private final SchemaContext schemaContext;
// FIXME : see below
// If transactionChain is not null then this transaction is part of a
Logging.getLogger(getContext().system(), this);
public ShardTransaction(DOMStoreReadWriteTransaction transaction,
- ActorRef shardActor) {
- this(null, transaction, shardActor);
+ ActorRef shardActor, SchemaContext schemaContext) {
+ this(null, transaction, shardActor, schemaContext);
}
public ShardTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadWriteTransaction transaction,
- ActorRef shardActor) {
+ ActorRef shardActor, SchemaContext schemaContext) {
this.transactionChain = transactionChain;
this.transaction = transaction;
this.shardActor = shardActor;
+ this.schemaContext = schemaContext;
}
public static Props props(final DOMStoreReadWriteTransaction transaction,
- final ActorRef shardActor) {
+ final ActorRef shardActor, final SchemaContext schemaContext) {
return Props.create(new Creator<ShardTransaction>() {
@Override
public ShardTransaction create() throws Exception {
- return new ShardTransaction(transaction, shardActor);
+ return new ShardTransaction(transaction, shardActor, schemaContext);
}
});
}
public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadWriteTransaction transaction,
- final ActorRef shardActor) {
+ final ActorRef shardActor, final SchemaContext schemaContext) {
return Props.create(new Creator<ShardTransaction>() {
@Override
public ShardTransaction create() throws Exception {
- return new ShardTransaction(transactionChain, transaction, shardActor);
+ return new ShardTransaction(transactionChain, transaction, shardActor, schemaContext);
}
});
}
@Override
public void handleReceive(Object message) throws Exception {
- if (message instanceof ReadData) {
- readData((ReadData) message);
- } else if (message instanceof WriteData) {
- writeData((WriteData) message);
- } else if (message instanceof MergeData) {
- mergeData((MergeData) message);
- } else if (message instanceof DeleteData) {
- deleteData((DeleteData) message);
- } else if (message instanceof ReadyTransaction) {
- readyTransaction((ReadyTransaction) message);
- } else if (message instanceof CloseTransaction) {
- closeTransaction((CloseTransaction) message);
+ if (ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+ readData(ReadData.fromSerializable(message));
+ } else if (WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+ writeData(WriteData.fromSerializable(message, schemaContext));
+ } else if (MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+ mergeData(MergeData.fromSerializable(message, schemaContext));
+ } else if (DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+ deleteData(DeleteData.fromSerizalizable(message));
+ } else if (ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
+ readyTransaction(new ReadyTransaction());
+ } else if (message.getClass().equals(CloseTransaction.SERIALIZABLE_CLASS)) {
+ closeTransaction(new CloseTransaction());
} else if (message instanceof GetCompositedModification) {
// This is here for testing only
getSender().tell(new GetCompositeModificationReply(
new ImmutableCompositeModification(modification)), getSelf());
+ }else{
+ throw new Exception ("Shard:handleRecieve received an unknown message"+message);
}
}
private void readData(ReadData message) {
final ActorRef sender = getSender();
final ActorRef self = getSelf();
- final InstanceIdentifier path = message.getPath();
+ final YangInstanceIdentifier path = message.getPath();
final ListenableFuture<Optional<NormalizedNode<?, ?>>> future =
transaction.read(path);
try {
Optional<NormalizedNode<?, ?>> optional = future.get();
if (optional.isPresent()) {
- sender.tell(new ReadDataReply(optional.get()), self);
+ sender.tell(new ReadDataReply(schemaContext,optional.get()).toSerializable(), self);
} else {
- sender.tell(new ReadDataReply(null), self);
+ sender.tell(new ReadDataReply(schemaContext,null).toSerializable(), self);
}
} catch (InterruptedException | ExecutionException e) {
log.error(e,
private void writeData(WriteData message) {
modification.addModification(
- new WriteModification(message.getPath(), message.getData()));
+ new WriteModification(message.getPath(), message.getData(),schemaContext));
+ LOG.debug("writeData at path : " + message.getPath().toString());
transaction.write(message.getPath(), message.getData());
- getSender().tell(new WriteDataReply(), getSelf());
+ getSender().tell(new WriteDataReply().toSerializable(), getSelf());
}
private void mergeData(MergeData message) {
modification.addModification(
- new MergeModification(message.getPath(), message.getData()));
+ new MergeModification(message.getPath(), message.getData(), schemaContext));
+ LOG.debug("mergeData at path : " + message.getPath().toString());
transaction.merge(message.getPath(), message.getData());
- getSender().tell(new MergeDataReply(), getSelf());
+ getSender().tell(new MergeDataReply().toSerializable(), getSelf());
}
private void deleteData(DeleteData message) {
modification.addModification(new DeleteModification(message.getPath()));
transaction.delete(message.getPath());
- getSender().tell(new DeleteDataReply(), getSelf());
+ getSender().tell(new DeleteDataReply().toSerializable(), getSelf());
}
private void readyTransaction(ReadyTransaction message) {
ActorRef cohortActor = getContext().actorOf(
ThreePhaseCommitCohort.props(cohort, shardActor, modification), "cohort");
getSender()
- .tell(new ReadyTransactionReply(cohortActor.path()), getSelf());
+ .tell(new ReadyTransactionReply(cohortActor.path()).toSerializable(), getSelf());
}
private void closeTransaction(CloseTransaction message) {
transaction.close();
- getSender().tell(new CloseTransactionReply(), getSelf());
+ getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
getSelf().tell(PoisonPill.getInstance(), getSelf());
}
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
/**
* The ShardTransactionChain Actor represents a remote TransactionChain
public class ShardTransactionChain extends AbstractUntypedActor {
private final DOMStoreTransactionChain chain;
+ private final SchemaContext schemaContext;
- public ShardTransactionChain(DOMStoreTransactionChain chain) {
+ public ShardTransactionChain(DOMStoreTransactionChain chain, SchemaContext schemaContext) {
this.chain = chain;
+ this.schemaContext = schemaContext;
}
@Override
public void handleReceive(Object message) throws Exception {
- if (message instanceof CreateTransaction) {
- CreateTransaction createTransaction = (CreateTransaction) message;
+ if (message.getClass().equals(CreateTransaction.SERIALIZABLE_CLASS)) {
+ CreateTransaction createTransaction = CreateTransaction.fromSerializable( message);
createTransaction(createTransaction);
- } else if (message instanceof CloseTransactionChain) {
+ } else if (message.getClass().equals(CloseTransactionChain.SERIALIZABLE_CLASS)) {
chain.close();
- getSender().tell(new CloseTransactionChainReply(), getSelf());
+ getSender().tell(new CloseTransactionChainReply().toSerializable(), getSelf());
+ }else{
+ throw new Exception("Not recognized message recieved="+message);
}
}
DOMStoreReadWriteTransaction transaction =
chain.newReadWriteTransaction();
ActorRef transactionActor = getContext().actorOf(ShardTransaction
- .props(chain, transaction, getContext().parent()), "shard-" + createTransaction.getTransactionId());
+ .props(chain, transaction, getContext().parent(), schemaContext), "shard-" + createTransaction.getTransactionId());
getSender()
- .tell(new CreateTransactionReply(transactionActor.path(), createTransaction.getTransactionId()),
+ .tell(new CreateTransactionReply(transactionActor.path().toString(),createTransaction.getTransactionId()).toSerializable(),
getSelf());
}
- public static Props props(final DOMStoreTransactionChain chain) {
+ public static Props props(final DOMStoreTransactionChain chain, final SchemaContext schemaContext) {
return Props.create(new Creator<ShardTransactionChain>() {
@Override
public ShardTransactionChain create() throws Exception {
- return new ShardTransactionChain(chain);
+ return new ShardTransactionChain(chain, schemaContext);
}
});
}
@Override
public void handleReceive(Object message) throws Exception {
- if (message instanceof CanCommitTransaction) {
- canCommit((CanCommitTransaction) message);
- } else if (message instanceof PreCommitTransaction) {
- preCommit((PreCommitTransaction) message);
- } else if (message instanceof CommitTransaction) {
- commit((CommitTransaction) message);
- } else if (message instanceof AbortTransaction) {
- abort((AbortTransaction) message);
+ if (message.getClass().equals(CanCommitTransaction.SERIALIZABLE_CLASS)) {
+ canCommit(new CanCommitTransaction());
+ } else if (message.getClass().equals(PreCommitTransaction.SERIALIZABLE_CLASS)) {
+ preCommit(new PreCommitTransaction());
+ } else if (message.getClass().equals(CommitTransaction.SERIALIZABLE_CLASS)) {
+ commit(new CommitTransaction());
+ } else if (message.getClass().equals(AbortTransaction.SERIALIZABLE_CLASS)) {
+ abort(new AbortTransaction());
+ } else {
+ throw new Exception ("Not recognized message received,message="+message);
}
}
public void run() {
try {
future.get();
- sender.tell(new AbortTransactionReply(), self);
+ sender.tell(new AbortTransactionReply().toSerializable(), self);
} catch (InterruptedException | ExecutionException e) {
log.error(e, "An exception happened when aborting");
}
public void run() {
try {
future.get();
- sender.tell(new PreCommitTransactionReply(), self);
+ sender.tell(new PreCommitTransactionReply().toSerializable(), self);
} catch (InterruptedException | ExecutionException e) {
log.error(e, "An exception happened when preCommitting");
}
public void run() {
try {
Boolean canCommit = future.get();
- sender.tell(new CanCommitTransactionReply(canCommit), self);
+ sender.tell(new CanCommitTransactionReply(canCommit).toSerializable(), self);
} catch (InterruptedException | ExecutionException e) {
log.error(e, "An exception happened when aborting");
}
try {
Object response =
actorContext.executeRemoteOperation(cohort,
- new CanCommitTransaction(),
+ new CanCommitTransaction().toSerializable(),
ActorContext.ASK_DURATION);
- if (response instanceof CanCommitTransactionReply) {
+ if (response.getClass().equals(CanCommitTransactionReply.SERIALIZABLE_CLASS)) {
CanCommitTransactionReply reply =
- (CanCommitTransactionReply) response;
+ CanCommitTransactionReply.fromSerializable(response);
if (!reply.getCanCommit()) {
return false;
}
}
@Override public ListenableFuture<Void> preCommit() {
- return voidOperation(new PreCommitTransaction(), PreCommitTransactionReply.class);
+ return voidOperation(new PreCommitTransaction().toSerializable(), PreCommitTransactionReply.SERIALIZABLE_CLASS);
}
@Override public ListenableFuture<Void> abort() {
- return voidOperation(new AbortTransaction(), AbortTransactionReply.class);
+ return voidOperation(new AbortTransaction().toSerializable(), AbortTransactionReply.SERIALIZABLE_CLASS);
}
@Override public ListenableFuture<Void> commit() {
- return voidOperation(new CommitTransaction(), CommitTransactionReply.class);
+ return voidOperation(new CommitTransaction().toSerializable(), CommitTransactionReply.SERIALIZABLE_CLASS);
}
private ListenableFuture<Void> voidOperation(final Object message, final Class expectedResponseClass){
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import java.util.concurrent.ExecutorService;
public class TransactionChainProxy implements DOMStoreTransactionChain{
private final ActorContext actorContext;
private final ExecutorService transactionExecutor;
+ private final SchemaContext schemaContext;
- public TransactionChainProxy(ActorContext actorContext, ExecutorService transactionExecutor) {
+ public TransactionChainProxy(ActorContext actorContext, ExecutorService transactionExecutor, SchemaContext schemaContext) {
this.actorContext = actorContext;
this.transactionExecutor = transactionExecutor;
+ this.schemaContext = schemaContext;
}
@Override
public DOMStoreReadTransaction newReadOnlyTransaction() {
return new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, schemaContext);
}
@Override
public DOMStoreReadWriteTransaction newReadWriteTransaction() {
return new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.WRITE_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.WRITE_ONLY, transactionExecutor, schemaContext);
}
@Override
public DOMStoreWriteTransaction newWriteOnlyTransaction() {
return new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_WRITE, transactionExecutor);
+ TransactionProxy.TransactionType.READ_WRITE, transactionExecutor, schemaContext);
}
@Override
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorPath;
+import akka.actor.ActorRef;
import akka.actor.ActorSelection;
+import akka.actor.Props;
import com.google.common.base.Optional;
+import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListenableFutureTask;
+import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException;
import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.WriteData;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
private static final AtomicLong counter = new AtomicLong();
+ private static final Logger
+ LOG = LoggerFactory.getLogger(TransactionProxy.class);
+
+
private final TransactionType transactionType;
private final ActorContext actorContext;
- private final Map<String, ActorSelection> remoteTransactionPaths = new HashMap<>();
+ private final Map<String, TransactionContext> remoteTransactionPaths = new HashMap<>();
private final String identifier;
private final ExecutorService executor;
+ private final SchemaContext schemaContext;
public TransactionProxy(
ActorContext actorContext,
TransactionType transactionType,
- ExecutorService executor
- ) {
+ ExecutorService executor,
+ SchemaContext schemaContext
+ ) {
- this.identifier = "txn-" + counter.getAndIncrement();
+ this.identifier = actorContext.getCurrentMemberName() + "-txn-" + counter.getAndIncrement();
this.transactionType = transactionType;
this.actorContext = actorContext;
this.executor = executor;
+ this.schemaContext = schemaContext;
+
- Object response = actorContext.executeShardOperation(Shard.DEFAULT_NAME, new CreateTransaction(identifier), ActorContext.ASK_DURATION);
- if(response instanceof CreateTransactionReply){
- CreateTransactionReply reply = (CreateTransactionReply) response;
- remoteTransactionPaths.put(Shard.DEFAULT_NAME, actorContext.actorSelection(reply.getTransactionPath()));
- }
}
@Override
- public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final InstanceIdentifier path) {
- final ActorSelection remoteTransaction = remoteTransactionFromIdentifier(path);
-
- Callable<Optional<NormalizedNode<?,?>>> call = new Callable() {
-
- @Override public Optional<NormalizedNode<?,?>> call() throws Exception {
- Object response = actorContext
- .executeRemoteOperation(remoteTransaction, new ReadData(path),
- ActorContext.ASK_DURATION);
- if(response instanceof ReadDataReply){
- ReadDataReply reply = (ReadDataReply) response;
- if(reply.getNormalizedNode() == null){
- return Optional.absent();
- }
- //FIXME : A cast should not be required here ???
- return (Optional<NormalizedNode<?, ?>>) Optional.of(reply.getNormalizedNode());
- }
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final YangInstanceIdentifier path) {
- return Optional.absent();
- }
- };
+ createTransactionIfMissing(actorContext, path);
- ListenableFutureTask<Optional<NormalizedNode<?, ?>>>
- future = ListenableFutureTask.create(call);
-
- executor.submit(future);
-
- return future;
+ return transactionContext(path).readData(path);
}
@Override
- public void write(InstanceIdentifier path, NormalizedNode<?, ?> data) {
- final ActorSelection remoteTransaction = remoteTransactionFromIdentifier(path);
- remoteTransaction.tell(new WriteData(path, data), null);
+ public void write(YangInstanceIdentifier path, NormalizedNode<?, ?> data) {
+
+ createTransactionIfMissing(actorContext, path);
+
+ transactionContext(path).writeData(path, data);
}
@Override
- public void merge(InstanceIdentifier path, NormalizedNode<?, ?> data) {
- final ActorSelection remoteTransaction = remoteTransactionFromIdentifier(path);
- remoteTransaction.tell(new MergeData(path, data), null);
+ public void merge(YangInstanceIdentifier path, NormalizedNode<?, ?> data) {
+
+ createTransactionIfMissing(actorContext, path);
+
+ transactionContext(path).mergeData(path, data);
}
@Override
- public void delete(InstanceIdentifier path) {
- final ActorSelection remoteTransaction = remoteTransactionFromIdentifier(path);
- remoteTransaction.tell(new DeleteData(path), null);
+ public void delete(YangInstanceIdentifier path) {
+
+ createTransactionIfMissing(actorContext, path);
+
+ transactionContext(path).deleteData(path);
}
@Override
public DOMStoreThreePhaseCommitCohort ready() {
List<ActorPath> cohortPaths = new ArrayList<>();
- for(ActorSelection remoteTransaction : remoteTransactionPaths.values()) {
- Object result = actorContext.executeRemoteOperation(remoteTransaction,
- new ReadyTransaction(),
- ActorContext.ASK_DURATION
- );
+ for(TransactionContext transactionContext : remoteTransactionPaths.values()) {
+ Object result = transactionContext.readyTransaction();
- if(result instanceof ReadyTransactionReply){
- ReadyTransactionReply reply = (ReadyTransactionReply) result;
- cohortPaths.add(reply.getCohortPath());
+ if(result.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)){
+ ReadyTransactionReply reply = ReadyTransactionReply.fromSerializable(actorContext.getActorSystem(),result);
+ String resolvedCohortPath = transactionContext
+ .getResolvedCohortPath(reply.getCohortPath().toString());
+ cohortPaths.add(actorContext.actorFor(resolvedCohortPath));
}
}
@Override
public void close() {
- for(ActorSelection remoteTransaction : remoteTransactionPaths.values()) {
- remoteTransaction.tell(new CloseTransaction(), null);
+ for(TransactionContext transactionContext : remoteTransactionPaths.values()) {
+ transactionContext.closeTransaction();
}
}
- private ActorSelection remoteTransactionFromIdentifier(InstanceIdentifier path){
+ private TransactionContext transactionContext(YangInstanceIdentifier path){
String shardName = shardNameFromIdentifier(path);
return remoteTransactionPaths.get(shardName);
}
- private String shardNameFromIdentifier(InstanceIdentifier path){
- return Shard.DEFAULT_NAME;
+ private String shardNameFromIdentifier(YangInstanceIdentifier path){
+ return ShardStrategyFactory.getStrategy(path).findShard(path);
+ }
+
+ private void createTransactionIfMissing(ActorContext actorContext, YangInstanceIdentifier path) {
+ String shardName = ShardStrategyFactory.getStrategy(path).findShard(path);
+
+ TransactionContext transactionContext =
+ remoteTransactionPaths.get(shardName);
+
+ if(transactionContext != null){
+ // A transaction already exists with that shard
+ return;
+ }
+
+ try {
+ Object response = actorContext.executeShardOperation(shardName,
+ new CreateTransaction(identifier).toSerializable(),
+ ActorContext.ASK_DURATION);
+ if (response.getClass()
+ .equals(CreateTransactionReply.SERIALIZABLE_CLASS)) {
+ CreateTransactionReply reply =
+ CreateTransactionReply.fromSerializable(response);
+
+ String transactionPath = reply.getTransactionPath();
+
+ LOG.info("Received transaction path = {}" , transactionPath );
+
+ ActorSelection transactionActor =
+ actorContext.actorSelection(transactionPath);
+ transactionContext =
+ new TransactionContextImpl(shardName, transactionPath,
+ transactionActor);
+
+ remoteTransactionPaths.put(shardName, transactionContext);
+ }
+ } catch(TimeoutException e){
+ remoteTransactionPaths.put(shardName, new NoOpTransactionContext(shardName));
+ }
+ }
+
+ private interface TransactionContext {
+ String getShardName();
+
+ String getResolvedCohortPath(String cohortPath);
+
+ public void closeTransaction();
+
+ public Object readyTransaction();
+
+ void deleteData(YangInstanceIdentifier path);
+
+ void mergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
+
+ ListenableFuture<Optional<NormalizedNode<?, ?>>> readData(final YangInstanceIdentifier path);
+
+ void writeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
+ }
+
+
+ private class TransactionContextImpl implements TransactionContext{
+ private final String shardName;
+ private final String actorPath;
+ private final ActorSelection actor;
+
+
+ private TransactionContextImpl(String shardName, String actorPath,
+ ActorSelection actor) {
+ this.shardName = shardName;
+ this.actorPath = actorPath;
+ this.actor = actor;
+ }
+
+ @Override public String getShardName() {
+ return shardName;
+ }
+
+ private ActorSelection getActor() {
+ return actor;
+ }
+
+ @Override public String getResolvedCohortPath(String cohortPath){
+ return actorContext.resolvePath(actorPath, cohortPath);
+ }
+
+ @Override public void closeTransaction() {
+ getActor().tell(
+ new CloseTransaction().toSerializable(), null);
+ }
+
+ @Override public Object readyTransaction() {
+ return actorContext.executeRemoteOperation(getActor(),
+ new ReadyTransaction().toSerializable(),
+ ActorContext.ASK_DURATION
+ );
+
+ }
+
+ @Override public void deleteData(YangInstanceIdentifier path) {
+ getActor().tell(new DeleteData(path).toSerializable(), null);
+ }
+
+ @Override public void mergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data){
+ getActor().tell(new MergeData(path, data, schemaContext).toSerializable(), null);
+ }
+
+ @Override public ListenableFuture<Optional<NormalizedNode<?, ?>>> readData(final YangInstanceIdentifier path) {
+
+ Callable<Optional<NormalizedNode<?,?>>> call = new Callable() {
+
+ @Override public Optional<NormalizedNode<?,?>> call() throws Exception {
+ Object response = actorContext
+ .executeRemoteOperation(getActor(), new ReadData(path).toSerializable(),
+ ActorContext.ASK_DURATION);
+ if(response.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)){
+ ReadDataReply reply = ReadDataReply.fromSerializable(schemaContext,path, response);
+ if(reply.getNormalizedNode() == null){
+ return Optional.absent();
+ }
+ //FIXME : A cast should not be required here ???
+ return (Optional<NormalizedNode<?, ?>>) Optional.of(reply.getNormalizedNode());
+ }
+
+ return Optional.absent();
+ }
+ };
+
+ ListenableFutureTask<Optional<NormalizedNode<?, ?>>>
+ future = ListenableFutureTask.create(call);
+
+ executor.submit(future);
+
+ return future;
+ }
+
+ @Override public void writeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data) {
+ getActor().tell(new WriteData(path, data, schemaContext).toSerializable(), null);
+ }
+
+ }
+
+ private class NoOpTransactionContext implements TransactionContext {
+
+ private final Logger
+ LOG = LoggerFactory.getLogger(NoOpTransactionContext.class);
+
+ private final String shardName;
+
+ private ActorRef cohort;
+
+ public NoOpTransactionContext(String shardName){
+ this.shardName = shardName;
+ }
+ @Override public String getShardName() {
+ return shardName;
+
+ }
+
+ @Override public String getResolvedCohortPath(String cohortPath) {
+ return cohort.path().toString();
+ }
+
+ @Override public void closeTransaction() {
+ LOG.error("closeTransaction called");
+ }
+
+ @Override public Object readyTransaction() {
+ LOG.error("readyTransaction called");
+ cohort = actorContext.getActorSystem().actorOf(Props.create(NoOpCohort.class));
+ return new ReadyTransactionReply(cohort.path()).toSerializable();
+ }
+
+ @Override public void deleteData(YangInstanceIdentifier path) {
+ LOG.error("deleteData called path = {}", path);
+ }
+
+ @Override public void mergeData(YangInstanceIdentifier path,
+ NormalizedNode<?, ?> data) {
+ LOG.error("mergeData called path = {}", path);
+ }
+
+ @Override
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> readData(
+ YangInstanceIdentifier path) {
+ LOG.error("readData called path = {}", path);
+ return Futures.immediateFuture(
+ Optional.<NormalizedNode<?, ?>>absent());
+ }
+
+ @Override public void writeData(YangInstanceIdentifier path,
+ NormalizedNode<?, ?> data) {
+ LOG.error("writeData called path = {}", path);
+ }
}
+
+
+
}
package org.opendaylight.controller.cluster.datastore.exceptions;
public class PrimaryNotFoundException extends RuntimeException {
+ public PrimaryNotFoundException(String message){
+ super(message);
+ }
}
package org.opendaylight.controller.cluster.datastore.exceptions;
public class TimeoutException extends RuntimeException {
- public TimeoutException(Exception e){
- super(e);
+ public TimeoutException(String message, Exception e){
+ super(message, e);
}
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans;
+
+
+import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import java.lang.management.ManagementFactory;
+
+/**
+ * All MBeans should extend this class that help in registering and
+ * unregistering the MBeans.
+ *
+ */
+
+
+public abstract class AbstractBaseMBean {
+
+
+ public static String BASE_JMX_PREFIX = "org.opendaylight.controller:";
+ public static String JMX_TYPE_DISTRIBUTED_DATASTORE = "DistributedDatastore";
+ public static String JMX_CATEGORY_SHARD = "Shard";
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(AbstractBaseMBean.class);
+
+ MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+ /**
+ * gets the MBean ObjectName
+ *
+ * @return Object name of the MBean
+ * @throws MalformedObjectNameException - The bean name does not have the right format.
+ * @throws NullPointerException - The bean name is null
+ */
+ protected ObjectName getMBeanObjectName()
+ throws MalformedObjectNameException, NullPointerException {
+ String name = BASE_JMX_PREFIX + "type="+getMBeanType()+",Category="+
+ getMBeanCategory() + ",name="+
+ getMBeanName();
+
+
+ return new ObjectName(name);
+ }
+
+ public boolean registerMBean() {
+ boolean registered = false;
+ try {
+ // Object to identify MBean
+ final ObjectName mbeanName = this.getMBeanObjectName();
+
+ Preconditions.checkArgument(mbeanName != null,
+ "Object name of the MBean cannot be null");
+
+ LOG.debug("Register MBean {}", mbeanName);
+
+ // unregistered if already registered
+ if (server.isRegistered(mbeanName)) {
+
+ LOG.debug("MBean {} found to be already registered", mbeanName);
+
+ try {
+ unregisterMBean(mbeanName);
+ } catch (Exception e) {
+
+ LOG.warn("unregister mbean {} resulted in exception {} ", mbeanName,
+ e);
+ }
+ }
+ server.registerMBean(this, mbeanName);
+
+ LOG.debug("MBean {} registered successfully",
+ mbeanName.getCanonicalName());
+ registered = true;
+ } catch (Exception e) {
+
+ LOG.error("registration failed {}", e);
+
+ }
+ return registered;
+ }
+
+
+ public boolean unregisterMBean() {
+ boolean unregister = false;
+ try {
+ ObjectName mbeanName = this.getMBeanObjectName();
+ unregister = true;
+ unregisterMBean(mbeanName);
+ } catch (Exception e) {
+
+ LOG.error("Failed when unregistering MBean {}", e);
+ }
+ return unregister;
+ }
+
+ private void unregisterMBean(ObjectName mbeanName)
+ throws MBeanRegistrationException, InstanceNotFoundException {
+
+ server.unregisterMBean(mbeanName);
+
+ }
+
+
+ /**
+ * @return name of bean
+ */
+ protected abstract String getMBeanName();
+
+ /**
+ * @return type of the MBean
+ */
+ protected abstract String getMBeanType();
+
+
+ /**
+ * @return Category name of teh bean
+ */
+ protected abstract String getMBeanCategory();
+
+ //require for test cases
+ public MBeanServer getMBeanServer() {
+ return server;
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author: syedbahm
+ * Date: 7/16/14
+ */
+public class ShardMBeanFactory {
+ private static Map<String,ShardStats> shardMBeans= new HashMap<String,ShardStats>();
+
+ public static ShardStats getShardStatsMBean(String shardName){
+ if(shardMBeans.containsKey(shardName)){
+ return shardMBeans.get(shardName);
+ }else {
+ ShardStats shardStatsMBeanImpl = new ShardStats(shardName);
+
+ if(shardStatsMBeanImpl.registerMBean()) {
+ shardMBeans.put(shardName, shardStatsMBeanImpl);
+ }
+ return shardStatsMBeanImpl;
+ }
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
+
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.AbstractBaseMBean;
+
+/**
+ * @author: syedbahm
+ */
+public class ShardStats extends AbstractBaseMBean implements ShardStatsMBean {
+ private Long committedTransactionsCount;
+ private Long journalMessagesCount;
+ final private String shardName;
+
+ ShardStats(String shardName){
+ this.shardName = shardName;
+ committedTransactionsCount =0L;
+ journalMessagesCount = 0L;
+ };
+
+
+ @Override
+ public String getShardName() {
+ return shardName;
+ }
+
+ @Override
+ public Long getCommittedTransactionsCount() {
+ return committedTransactionsCount;
+ }
+
+ @Override
+ public Long getJournalMessagesCount() {
+ //FIXME: this will be populated once after integration with Raft stuff
+ return journalMessagesCount;
+ }
+
+
+ public Long incrementCommittedTransactionCount() {
+ return committedTransactionsCount++;
+ }
+
+
+ public void updateCommittedTransactionsCount(long currentCount){
+ committedTransactionsCount = currentCount;
+
+ }
+
+ public void updateJournalMessagesCount(long currentCount){
+ journalMessagesCount = currentCount;
+
+ }
+
+
+
+ @Override
+ protected String getMBeanName() {
+ return shardName;
+ }
+
+ @Override
+ protected String getMBeanType() {
+ return JMX_TYPE_DISTRIBUTED_DATASTORE;
+ }
+
+ @Override
+ protected String getMBeanCategory() {
+ return JMX_CATEGORY_SHARD;
+ }
+
+
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
+
+/**
+ * @author: syedbahm
+ */
+public interface ShardStatsMBean {
+ String getShardName();
+ Long getCommittedTransactionsCount();
+ Long getJournalMessagesCount();
+
+}
package org.opendaylight.controller.cluster.datastore.messages;
-public class AbortTransaction {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class AbortTransaction implements SerializableMessage {
+ public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransaction.class;
+
+ @Override
+ public Object toSerializable() {
+ return ThreePhaseCommitCohortMessages.AbortTransaction.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class AbortTransactionReply {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class AbortTransactionReply implements SerializableMessage {
+ public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransactionReply.class;
+
+
+ @Override
+ public Object toSerializable() {
+ return ThreePhaseCommitCohortMessages.AbortTransactionReply.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CanCommitTransaction {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class CanCommitTransaction implements SerializableMessage {
+ public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransaction.class;
+
+ @Override
+ public Object toSerializable() {
+ return ThreePhaseCommitCohortMessages.CanCommitTransaction.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CanCommitTransactionReply {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class CanCommitTransactionReply implements SerializableMessage {
+ public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class;
private final Boolean canCommit;
public CanCommitTransactionReply(Boolean canCommit) {
public Boolean getCanCommit() {
return canCommit;
}
+
+ @Override
+ public Object toSerializable() {
+ return ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(canCommit).build();
+ }
+
+
+ public static CanCommitTransactionReply fromSerializable(Object message) {
+ return new CanCommitTransactionReply(((ThreePhaseCommitCohortMessages.CanCommitTransactionReply)message).getCanCommit());
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CloseDataChangeListenerRegistration {
+import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
+
+public class CloseDataChangeListenerRegistration implements SerializableMessage {
+ public static Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class;
+ @Override
+ public Object toSerializable() {
+ return ListenerRegistrationMessages.CloseDataChangeListenerRegistration.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CloseDataChangeListenerRegistrationReply {
+import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
+
+public class CloseDataChangeListenerRegistrationReply implements SerializableMessage{
+ public static Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.class;
+
+ @Override
+ public Object toSerializable() {
+ return ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.newBuilder().build();
+ }
+
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CloseTransaction {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class CloseTransaction implements SerializableMessage{
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CloseTransaction.class;
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionMessages.CloseTransaction.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CloseTransactionChain {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
+
+public class CloseTransactionChain implements SerializableMessage{
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CloseTransactionChain.class;
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionChainMessages.CloseTransactionChain.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CloseTransactionChainReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
+
+public class CloseTransactionChainReply implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CloseTransactionChainReply.class;
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionChainMessages.CloseTransactionChainReply.newBuilder().build();
+ }
+
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CloseTransactionReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class CloseTransactionReply implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CloseTransactionReply.class;
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionMessages.CloseTransactionReply.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CommitTransaction {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class CommitTransaction implements SerializableMessage {
+ public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransaction.class;
+
+ @Override
+ public Object toSerializable() {
+ return ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CommitTransactionReply {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class CommitTransactionReply implements SerializableMessage {
+
+ public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransactionReply.class;
+
+ @Override
+ public Object toSerializable() {
+ return ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CreateTransaction {
- private final String transactionId;
- public CreateTransaction(String transactionId){
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
- this.transactionId = transactionId;
- }
- public String getTransactionId() {
- return transactionId;
- }
+public class CreateTransaction implements SerializableMessage {
+ public static Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransaction.class;
+ private final String transactionId;
+
+ public CreateTransaction(String transactionId){
+
+ this.transactionId = transactionId;
+ }
+
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionMessages.CreateTransaction.newBuilder().setTransactionId(transactionId).build();
+ }
+
+ public static CreateTransaction fromSerializable(Object message){
+ return new CreateTransaction(((ShardTransactionMessages.CreateTransaction)message).getTransactionId());
+ }
+
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class CreateTransactionChain {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
+public class CreateTransactionChain implements SerializableMessage{
+ public static Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CreateTransactionChain.class;
+
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionChainMessages.CreateTransactionChain.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
import akka.actor.ActorPath;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
-public class CreateTransactionChainReply {
+public class CreateTransactionChainReply implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CreateTransactionChainReply.class;
private final ActorPath transactionChainPath;
public CreateTransactionChainReply(ActorPath transactionChainPath) {
public ActorPath getTransactionChainPath() {
return transactionChainPath;
}
+
+ @Override
+ public ShardTransactionChainMessages.CreateTransactionChainReply toSerializable() {
+ return ShardTransactionChainMessages.CreateTransactionChainReply.newBuilder()
+ .setTransactionChainPath(transactionChainPath.toString()).build();
+ }
+
+ public static CreateTransactionChainReply fromSerializable(ActorSystem actorSystem,Object serializable){
+ ShardTransactionChainMessages.CreateTransactionChainReply o = (ShardTransactionChainMessages.CreateTransactionChainReply) serializable;
+ return new CreateTransactionChainReply(
+ actorSystem.actorFor(o.getTransactionChainPath()).path());
+ }
+
}
package org.opendaylight.controller.cluster.datastore.messages;
-import akka.actor.ActorPath;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
-public class CreateTransactionReply {
- private final ActorPath transactionPath;
+public class CreateTransactionReply implements SerializableMessage {
+
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransactionReply.class;
+ private final String transactionPath;
private final String transactionId;
- public CreateTransactionReply(ActorPath transactionPath,
+ public CreateTransactionReply(String transactionPath,
String transactionId) {
this.transactionPath = transactionPath;
this.transactionId = transactionId;
}
- public ActorPath getTransactionPath() {
+ public String getTransactionPath() {
return transactionPath;
}
public String getTransactionId() {
return transactionId;
}
+
+ public Object toSerializable(){
+ return ShardTransactionMessages.CreateTransactionReply.newBuilder()
+ .setTransactionActorPath(transactionPath)
+ .setTransactionId(transactionId)
+ .build();
+ }
+
+ public static CreateTransactionReply fromSerializable(Object serializable){
+ ShardTransactionMessages.CreateTransactionReply o = (ShardTransactionMessages.CreateTransactionReply) serializable;
+ return new CreateTransactionReply(o.getTransactionActorPath(), o.getTransactionId());
+ }
+
}
package org.opendaylight.controller.cluster.datastore.messages;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-public class DataChanged {
- private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class DataChanged implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS =
+ DataChangeListenerMessages.DataChanged.class;
+ final private SchemaContext schemaContext;
+ private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>
change;
- public DataChanged(
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+
+
+ public DataChanged(SchemaContext schemaContext,
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
this.change = change;
+ this.schemaContext = schemaContext;
}
- public AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> getChange() {
+
+ public AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> getChange() {
return change;
}
+
+
+ private NormalizedNodeMessages.Node convertToNodeTree(
+ NormalizedNode<?, ?> normalizedNode) {
+
+ return new NormalizedNodeToNodeCodec(schemaContext)
+ .encode(YangInstanceIdentifier.builder().build(), normalizedNode)
+ .getNormalizedNode();
+
+ }
+
+ private Iterable<NormalizedNodeMessages.InstanceIdentifier> convertToRemovePaths(
+ Set<YangInstanceIdentifier> removedPaths) {
+ final Set<NormalizedNodeMessages.InstanceIdentifier> removedPathInstanceIds = new HashSet<>();
+ for (YangInstanceIdentifier id : removedPaths) {
+ removedPathInstanceIds.add(InstanceIdentifierUtils.toSerializable(id));
+ }
+ return new Iterable<NormalizedNodeMessages.InstanceIdentifier>() {
+ public Iterator<NormalizedNodeMessages.InstanceIdentifier> iterator() {
+ return removedPathInstanceIds.iterator();
+ }
+ };
+
+ }
+
+ private NormalizedNodeMessages.NodeMap convertToNodeMap(
+ Map<YangInstanceIdentifier, NormalizedNode<?, ?>> data) {
+ NormalizedNodeToNodeCodec normalizedNodeToNodeCodec =
+ new NormalizedNodeToNodeCodec(schemaContext);
+ NormalizedNodeMessages.NodeMap.Builder nodeMapBuilder =
+ NormalizedNodeMessages.NodeMap.newBuilder();
+ NormalizedNodeMessages.NodeMapEntry.Builder builder =
+ NormalizedNodeMessages.NodeMapEntry.newBuilder();
+ for (Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry : data
+ .entrySet()) {
+
+
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(entry.getKey());
+
+ builder.setInstanceIdentifierPath(instanceIdentifier)
+ .setNormalizedNode(normalizedNodeToNodeCodec
+ .encode(entry.getKey(), entry.getValue())
+ .getNormalizedNode());
+ nodeMapBuilder.addMapEntries(builder.build());
+ }
+ return nodeMapBuilder.build();
+ }
+
+
+ @Override
+ public Object toSerializable() {
+ return DataChangeListenerMessages.DataChanged.newBuilder()
+ .addAllRemovedPaths(convertToRemovePaths(change.getRemovedPaths()))
+ .setCreatedData(convertToNodeMap(change.getCreatedData()))
+ .setOriginalData(convertToNodeMap(change.getOriginalData()))
+ .setUpdatedData(convertToNodeMap(change.getUpdatedData()))
+ .setOriginalSubTree(convertToNodeTree(change.getOriginalSubtree()))
+ .setUpdatedSubTree(convertToNodeTree(change.getUpdatedSubtree()))
+ .build();
+ }
+
+ public static DataChanged fromSerialize(SchemaContext sc, Object message,
+ YangInstanceIdentifier pathId) {
+ DataChangeListenerMessages.DataChanged dataChanged =
+ (DataChangeListenerMessages.DataChanged) message;
+ DataChangedEvent event = new DataChangedEvent(sc);
+ if (dataChanged.getCreatedData() != null && dataChanged.getCreatedData()
+ .isInitialized()) {
+ event.setCreatedData(dataChanged.getCreatedData());
+ }
+ if (dataChanged.getOriginalData() != null && dataChanged
+ .getOriginalData().isInitialized()) {
+ event.setOriginalData(dataChanged.getOriginalData());
+ }
+
+ if (dataChanged.getUpdatedData() != null && dataChanged.getUpdatedData()
+ .isInitialized()) {
+ event.setUpdateData(dataChanged.getUpdatedData());
+ }
+
+ if (dataChanged.getOriginalSubTree() != null && dataChanged
+ .getOriginalSubTree().isInitialized()) {
+ event.setOriginalSubtree(dataChanged.getOriginalSubTree(), pathId);
+ }
+
+ if (dataChanged.getUpdatedSubTree() != null && dataChanged
+ .getUpdatedSubTree().isInitialized()) {
+ event.setUpdatedSubtree(dataChanged.getOriginalSubTree(), pathId);
+ }
+
+ if (dataChanged.getRemovedPathsList() != null && !dataChanged
+ .getRemovedPathsList().isEmpty()) {
+ event.setRemovedPaths(dataChanged.getRemovedPathsList());
+ }
+
+ return new DataChanged(sc, event);
+
+ }
+
+ static class DataChangedEvent implements
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
+ private final SchemaContext schemaContext;
+ private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> createdData;
+ private final NormalizedNodeToNodeCodec nodeCodec;
+ private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> updatedData;
+ private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> originalData;
+ private NormalizedNode<?, ?> originalSubTree;
+ private NormalizedNode<?, ?> updatedSubTree;
+ private Set<YangInstanceIdentifier> removedPathIds;
+
+ DataChangedEvent(SchemaContext schemaContext) {
+ this.schemaContext = schemaContext;
+ nodeCodec = new NormalizedNodeToNodeCodec(schemaContext);
+ }
+
+ @Override
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+ if(createdData == null){
+ return Collections.emptyMap();
+ }
+ return createdData;
+ }
+
+ DataChangedEvent setCreatedData(
+ NormalizedNodeMessages.NodeMap nodeMap) {
+ this.createdData = convertNodeMapToMap(nodeMap);
+ return this;
+ }
+
+ private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> convertNodeMapToMap(
+ NormalizedNodeMessages.NodeMap nodeMap) {
+ Map<YangInstanceIdentifier, NormalizedNode<?, ?>> mapEntries =
+ new HashMap<YangInstanceIdentifier, NormalizedNode<?, ?>>();
+ for (NormalizedNodeMessages.NodeMapEntry nodeMapEntry : nodeMap
+ .getMapEntriesList()) {
+ YangInstanceIdentifier id = InstanceIdentifierUtils
+ .fromSerializable(nodeMapEntry.getInstanceIdentifierPath());
+ mapEntries.put(id,
+ nodeCodec.decode(id, nodeMapEntry.getNormalizedNode()));
+ }
+ return mapEntries;
+ }
+
+
+ @Override
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+ if(updatedData == null){
+ return Collections.emptyMap();
+ }
+ return updatedData;
+ }
+
+ DataChangedEvent setUpdateData(NormalizedNodeMessages.NodeMap nodeMap) {
+ this.updatedData = convertNodeMapToMap(nodeMap);
+ return this;
+ }
+
+ @Override
+ public Set<YangInstanceIdentifier> getRemovedPaths() {
+ if (removedPathIds == null) {
+ return Collections.emptySet();
+ }
+ return removedPathIds;
+ }
+
+ public DataChangedEvent setRemovedPaths(List<NormalizedNodeMessages.InstanceIdentifier> removedPaths) {
+ Set<YangInstanceIdentifier> removedIds = new HashSet<>();
+ for (NormalizedNodeMessages.InstanceIdentifier path : removedPaths) {
+ removedIds.add(InstanceIdentifierUtils.fromSerializable(path));
+ }
+ this.removedPathIds = removedIds;
+ return this;
+ }
+
+ @Override
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
+ if (originalData == null) {
+ Collections.emptyMap();
+ }
+ return originalData;
+ }
+
+ DataChangedEvent setOriginalData(
+ NormalizedNodeMessages.NodeMap nodeMap) {
+ this.originalData = convertNodeMapToMap(nodeMap);
+ return this;
+ }
+
+ @Override
+ public NormalizedNode<?, ?> getOriginalSubtree() {
+ return originalSubTree;
+ }
+
+ DataChangedEvent setOriginalSubtree(NormalizedNodeMessages.Node node,
+ YangInstanceIdentifier instanceIdentifierPath) {
+ originalSubTree = nodeCodec.decode(instanceIdentifierPath, node);
+ return this;
+ }
+
+ @Override
+ public NormalizedNode<?, ?> getUpdatedSubtree() {
+ return updatedSubTree;
+ }
+
+ DataChangedEvent setUpdatedSubtree(NormalizedNodeMessages.Node node,
+ YangInstanceIdentifier instanceIdentifierPath) {
+ updatedSubTree = nodeCodec.decode(instanceIdentifierPath, node);
+ return this;
+ }
+
+
+ }
+
+
+
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class DataChangedReply {
+import org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages;
+
+public class DataChangedReply implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS = DataChangeListenerMessages.DataChangedReply.class;
+ @Override
+ public Object toSerializable() {
+ return DataChangeListenerMessages.DataChangedReply.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-public class DeleteData {
- private final InstanceIdentifier path;
+public class DeleteData implements SerializableMessage {
- public DeleteData(InstanceIdentifier path) {
- this.path = path;
- }
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.DeleteData.class;
- public InstanceIdentifier getPath() {
- return path;
- }
+ private final YangInstanceIdentifier path;
+
+ public DeleteData(YangInstanceIdentifier path) {
+ this.path = path;
+ }
+
+ public YangInstanceIdentifier getPath() {
+ return path;
+ }
+
+ @Override public Object toSerializable() {
+ return ShardTransactionMessages.DeleteData.newBuilder()
+ .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path)).build();
+ }
+
+ public static DeleteData fromSerizalizable(Object serializable){
+ ShardTransactionMessages.DeleteData o = (ShardTransactionMessages.DeleteData) serializable;
+ return new DeleteData(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments()));
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class DeleteDataReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class DeleteDataReply implements SerializableMessage{
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.DeleteDataReply.class;
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionMessages.DeleteDataReply.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
import com.google.common.base.Preconditions;
+import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
/**
* The FindPrimary message is used to locate the primary of any given shard
*
- * TODO : Make this serializable
*/
-public class FindPrimary{
+public class FindPrimary implements SerializableMessage{
+ public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.FindPrimary.class;
private final String shardName;
public FindPrimary(String shardName){
public String getShardName() {
return shardName;
}
+
+ @Override
+ public Object toSerializable() {
+ return ShardManagerMessages.FindPrimary.newBuilder().setShardName(shardName).build();
+ }
+
+ public static FindPrimary fromSerializable(Object message){
+ return new FindPrimary(((ShardManagerMessages.FindPrimary)message).getShardName());
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-public class MergeData extends ModifyData {
- public MergeData(InstanceIdentifier path, NormalizedNode<?, ?> data) {
- super(path, data);
- }
+public class MergeData extends ModifyData{
+
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.MergeData.class;
+
+ public MergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data,
+ SchemaContext context) {
+ super(path, data, context);
+ }
+
+ @Override public Object toSerializable() {
+
+ NormalizedNodeMessages.Node normalizedNode =
+ new NormalizedNodeToNodeCodec(schemaContext).encode(path, data)
+ .getNormalizedNode();
+ return ShardTransactionMessages.MergeData.newBuilder()
+ .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path))
+ .setNormalizedNode(normalizedNode).build();
+ }
+
+ public static MergeData fromSerializable(Object serializable, SchemaContext schemaContext){
+ ShardTransactionMessages.MergeData o = (ShardTransactionMessages.MergeData) serializable;
+ YangInstanceIdentifier identifier = InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments());
+
+ NormalizedNode<?, ?> normalizedNode =
+ new NormalizedNodeToNodeCodec(schemaContext)
+ .decode(identifier, o.getNormalizedNode());
+
+ return new MergeData(identifier, normalizedNode, schemaContext);
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class MergeDataReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class MergeDataReply implements SerializableMessage{
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.MergeDataReply.class;
+
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionMessages.MergeDataReply.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-public abstract class ModifyData {
- private final InstanceIdentifier path;
- private final NormalizedNode<?,?> data;
+public abstract class ModifyData implements SerializableMessage {
+ protected final YangInstanceIdentifier path;
+ protected final NormalizedNode<?, ?> data;
+ protected final SchemaContext schemaContext;
- public ModifyData(InstanceIdentifier path, NormalizedNode<?, ?> data) {
- this.path = path;
- this.data = data;
- }
+ public ModifyData(YangInstanceIdentifier path, NormalizedNode<?, ?> data,
+ SchemaContext context) {
+ Preconditions.checkNotNull(context,
+ "Cannot serialize an object which does not have a schema schemaContext");
- public InstanceIdentifier getPath() {
- return path;
- }
- public NormalizedNode<?, ?> getData() {
- return data;
- }
+ this.path = path;
+ this.data = data;
+ this.schemaContext = context;
+ }
+
+ public YangInstanceIdentifier getPath() {
+ return path;
+ }
+
+ public NormalizedNode<?, ?> getData() {
+ return data;
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.messages;
+
+public class PeerAddressResolved {
+ private final String peerId;
+ private final String peerAddress;
+
+ public PeerAddressResolved(String peerId, String peerAddress) {
+ this.peerId = peerId;
+ this.peerAddress = peerAddress;
+ }
+
+ public String getPeerId() {
+ return peerId;
+ }
+
+ public String getPeerAddress() {
+ return peerAddress;
+ }
+}
package org.opendaylight.controller.cluster.datastore.messages;
-public class PreCommitTransaction {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class PreCommitTransaction implements SerializableMessage{
+
+ public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransaction.class;
+
+ @Override
+ public Object toSerializable() {
+ return ThreePhaseCommitCohortMessages.PreCommitTransaction.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class PreCommitTransactionReply {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class PreCommitTransactionReply implements SerializableMessage{
+
+ public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class;
+
+ @Override
+ public Object toSerializable() {
+ return ThreePhaseCommitCohortMessages.PreCommitTransactionReply.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class PrimaryFound {
+import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
+
+public class PrimaryFound implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.PrimaryFound.class;
private final String primaryPath;
public PrimaryFound(String primaryPath) {
}
+ @Override
+ public Object toSerializable() {
+ return ShardManagerMessages.PrimaryFound.newBuilder().setPrimaryPath(primaryPath).build();
+ }
+
+ public static PrimaryFound fromSerializable(Object message){
+ return new PrimaryFound(((ShardManagerMessages.PrimaryFound)message).getPrimaryPath());
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
import com.google.common.base.Preconditions;
+import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
-public class PrimaryNotFound {
+public class PrimaryNotFound implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.PrimaryNotFound.class;
private final String shardName;
public int hashCode() {
return shardName != null ? shardName.hashCode() : 0;
}
+
+ @Override
+ public Object toSerializable() {
+ return ShardManagerMessages.PrimaryNotFound.newBuilder().setShardName(shardName).build();
+ }
+
+ public static PrimaryNotFound fromSerializable(Object message){
+ return new PrimaryNotFound(((ShardManagerMessages.PrimaryNotFound)message).getShardName());
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class ReadData {
- private final InstanceIdentifier path;
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadData.class;
+ private final YangInstanceIdentifier path;
- public ReadData(InstanceIdentifier path) {
+ public ReadData(YangInstanceIdentifier path) {
this.path = path;
}
- public InstanceIdentifier getPath() {
+ public YangInstanceIdentifier getPath() {
return path;
}
+
+ public Object toSerializable(){
+ return ShardTransactionMessages.ReadData.newBuilder()
+ .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path))
+ .build();
+ }
+
+ public static ReadData fromSerializable(Object serializable){
+ ShardTransactionMessages.ReadData o = (ShardTransactionMessages.ReadData) serializable;
+ return new ReadData(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments()));
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-public class ReadDataReply {
- private final NormalizedNode<?, ?> normalizedNode;
+public class ReadDataReply implements SerializableMessage{
- public ReadDataReply(NormalizedNode<?, ?> normalizedNode){
+ private final NormalizedNode<?, ?> normalizedNode;
+ private final SchemaContext schemaContext;
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadDataReply.class;
+ public ReadDataReply(SchemaContext context,NormalizedNode<?, ?> normalizedNode){
this.normalizedNode = normalizedNode;
+ this.schemaContext = context;
}
public NormalizedNode<?, ?> getNormalizedNode() {
return normalizedNode;
}
+
+ public Object toSerializable(){
+ if(normalizedNode != null) {
+ return ShardTransactionMessages.ReadDataReply.newBuilder()
+ .setNormalizedNode(new NormalizedNodeToNodeCodec(schemaContext)
+ .encode(YangInstanceIdentifier.builder().build(), normalizedNode).getNormalizedNode()
+ ).build();
+ }else{
+ return ShardTransactionMessages.ReadDataReply.newBuilder().build();
+
+ }
+
+ }
+
+ public static ReadDataReply fromSerializable(SchemaContext schemaContext,YangInstanceIdentifier id,Object serializable){
+ ShardTransactionMessages.ReadDataReply o = (ShardTransactionMessages.ReadDataReply) serializable;
+ return new ReadDataReply(schemaContext,new NormalizedNodeToNodeCodec(schemaContext).decode(id, o.getNormalizedNode()));
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class ReadyTransaction {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class ReadyTransaction implements SerializableMessage{
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadyTransaction.class;
+
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionMessages.ReadyTransaction.newBuilder().build();
+ }
+
}
package org.opendaylight.controller.cluster.datastore.messages;
import akka.actor.ActorPath;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
-public class ReadyTransactionReply {
+public class ReadyTransactionReply implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadyTransactionReply.class;
private final ActorPath cohortPath;
public ReadyTransactionReply(ActorPath cohortPath) {
public ActorPath getCohortPath() {
return cohortPath;
}
+
+ @Override
+ public ShardTransactionMessages.ReadyTransactionReply toSerializable() {
+ return ShardTransactionMessages.ReadyTransactionReply.newBuilder()
+ .setActorPath(cohortPath.toString()).build();
+ }
+
+ public static ReadyTransactionReply fromSerializable(ActorSystem actorSystem,Object serializable){
+ ShardTransactionMessages.ReadyTransactionReply o = (ShardTransactionMessages.ReadyTransactionReply) serializable;
+ return new ReadyTransactionReply(
+ actorSystem.actorFor(o.getActorPath()).path());
+ }
}
package org.opendaylight.controller.cluster.datastore.messages;
import akka.actor.ActorPath;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-public class RegisterChangeListener {
- private final InstanceIdentifier path;
+public class RegisterChangeListener implements SerializableMessage {
+ public static final Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.RegisterChangeListener.class;
+ private final YangInstanceIdentifier path;
private final ActorPath dataChangeListenerPath;
private final AsyncDataBroker.DataChangeScope scope;
- public RegisterChangeListener(InstanceIdentifier path,
+ public RegisterChangeListener(YangInstanceIdentifier path,
ActorPath dataChangeListenerPath,
AsyncDataBroker.DataChangeScope scope) {
this.path = path;
this.scope = scope;
}
- public InstanceIdentifier getPath() {
+ public YangInstanceIdentifier getPath() {
return path;
}
public ActorPath getDataChangeListenerPath() {
return dataChangeListenerPath;
}
+
+
+ @Override
+ public ListenerRegistrationMessages.RegisterChangeListener toSerializable() {
+ return ListenerRegistrationMessages.RegisterChangeListener.newBuilder()
+ .setInstanceIdentifierPath(InstanceIdentifierUtils.toSerializable(path))
+ .setDataChangeListenerActorPath(dataChangeListenerPath.toString())
+ .setDataChangeScope(scope.ordinal()).build();
+ }
+
+ public static RegisterChangeListener fromSerializable(ActorSystem actorSystem,Object serializable){
+ ListenerRegistrationMessages.RegisterChangeListener o = (ListenerRegistrationMessages.RegisterChangeListener) serializable;
+ return new RegisterChangeListener(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPath()),
+ actorSystem.actorFor(o.getDataChangeListenerActorPath()).path(),
+ AsyncDataBroker.DataChangeScope.values()[o.getDataChangeScope()]);
+ }
+
+
}
package org.opendaylight.controller.cluster.datastore.messages;
import akka.actor.ActorPath;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
-public class RegisterChangeListenerReply {
+public class RegisterChangeListenerReply implements SerializableMessage{
+ public static final Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.RegisterChangeListenerReply.class;
private final ActorPath listenerRegistrationPath;
public RegisterChangeListenerReply(ActorPath listenerRegistrationPath) {
public ActorPath getListenerRegistrationPath() {
return listenerRegistrationPath;
}
+
+ @Override
+ public ListenerRegistrationMessages.RegisterChangeListenerReply toSerializable() {
+ return ListenerRegistrationMessages.RegisterChangeListenerReply.newBuilder()
+ .setListenerRegistrationPath(listenerRegistrationPath.toString()).build();
+ }
+
+ public static RegisterChangeListenerReply fromSerializable(ActorSystem actorSystem,Object serializable){
+ ListenerRegistrationMessages.RegisterChangeListenerReply o = (ListenerRegistrationMessages.RegisterChangeListenerReply) serializable;
+ return new RegisterChangeListenerReply(
+ actorSystem.actorFor(o.getListenerRegistrationPath()).path()
+ );
+ }
}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.cluster.raft.internal.messages;
+package org.opendaylight.controller.cluster.datastore.messages;
-public class ElectionTimeout {
+public interface SerializableMessage {
+ Object toSerializable();
}
package org.opendaylight.controller.cluster.datastore.messages;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class WriteData extends ModifyData{
- public WriteData(InstanceIdentifier path, NormalizedNode<?, ?> data) {
- super(path, data);
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.WriteData.class;
+
+ public WriteData(YangInstanceIdentifier path, NormalizedNode<?, ?> data, SchemaContext schemaContext) {
+ super(path, data, schemaContext);
}
+
+ @Override public Object toSerializable() {
+
+ NormalizedNodeMessages.Node normalizedNode =
+ new NormalizedNodeToNodeCodec(schemaContext).encode(path, data)
+ .getNormalizedNode();
+ return ShardTransactionMessages.WriteData.newBuilder()
+ .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path))
+ .setNormalizedNode(normalizedNode).build();
+
+ }
+
+ public static WriteData fromSerializable(Object serializable, SchemaContext schemaContext){
+ ShardTransactionMessages.WriteData o = (ShardTransactionMessages.WriteData) serializable;
+ YangInstanceIdentifier identifier = InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments());
+
+ NormalizedNode<?, ?> normalizedNode =
+ new NormalizedNodeToNodeCodec(schemaContext)
+ .decode(identifier, o.getNormalizedNode());
+
+ return new WriteData(identifier, normalizedNode, schemaContext);
+ }
+
}
package org.opendaylight.controller.cluster.datastore.messages;
-public class WriteDataReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class WriteDataReply implements SerializableMessage{
+ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.WriteDataReply.class;
+ @Override
+ public Object toSerializable() {
+ return ShardTransactionMessages.WriteDataReply.newBuilder().build();
+ }
}
package org.opendaylight.controller.cluster.datastore.modification;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import java.io.Serializable;
private static final long serialVersionUID = 1638042650152084457L;
- protected final InstanceIdentifier path;
+ protected final YangInstanceIdentifier path;
- protected AbstractModification(InstanceIdentifier path) {
+ protected AbstractModification(YangInstanceIdentifier path) {
this.path = path;
}
}
package org.opendaylight.controller.cluster.datastore.modification;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
* DeleteModification store all the parameters required to delete a path from the data tree
*/
public class DeleteModification extends AbstractModification {
- public DeleteModification(InstanceIdentifier path) {
+ public DeleteModification(YangInstanceIdentifier path) {
super(path);
}
public void apply(DOMStoreWriteTransaction transaction) {
transaction.delete(path);
}
+
+ @Override public Object toSerializable() {
+ return PersistentMessages.Modification.newBuilder()
+ .setType(this.getClass().toString())
+ .setPath(InstanceIdentifierUtils.toSerializable(this.path))
+ .build();
+ }
+
+ public static DeleteModification fromSerializable(Object serializable){
+ PersistentMessages.Modification o = (PersistentMessages.Modification) serializable;
+ return new DeleteModification(InstanceIdentifierUtils.fromSerializable(o.getPath()));
+ }
}
package org.opendaylight.controller.cluster.datastore.modification;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
import java.util.List;
-public class ImmutableCompositeModification implements CompositeModification{
+public class ImmutableCompositeModification implements CompositeModification {
- private final CompositeModification modification;
+ private final CompositeModification modification;
- public ImmutableCompositeModification(CompositeModification modification){
- this.modification = modification;
- }
+ public ImmutableCompositeModification(CompositeModification modification) {
+ this.modification = modification;
+ }
- @Override
- public List<Modification> getModifications() {
- return modification.getModifications();
- }
+ @Override
+ public List<Modification> getModifications() {
+ return modification.getModifications();
+ }
- @Override
- public void apply(DOMStoreWriteTransaction transaction) {
- modification.apply(transaction);
- }
+ @Override
+ public void apply(DOMStoreWriteTransaction transaction) {
+ modification.apply(transaction);
+ }
+
+ @Override public Object toSerializable() {
+
+ PersistentMessages.CompositeModification.Builder builder =
+ PersistentMessages.CompositeModification.newBuilder();
+
+ for (Modification m : modification.getModifications()) {
+ builder.addModification(
+ (PersistentMessages.Modification) m.toSerializable());
+ }
+
+ return builder.build();
+ }
}
package org.opendaylight.controller.cluster.datastore.modification;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
/**
* MergeModification stores all the parameters required to merge data into the specified path
*/
-public class MergeModification extends AbstractModification{
- private final NormalizedNode data;
+public class MergeModification extends AbstractModification {
+ private final NormalizedNode data;
+ private final SchemaContext schemaContext;
- public MergeModification(InstanceIdentifier path, NormalizedNode data) {
- super(path);
- this.data = data;
- }
+ public MergeModification(YangInstanceIdentifier path, NormalizedNode data,
+ SchemaContext schemaContext) {
+ super(path);
+ this.data = data;
+ this.schemaContext = schemaContext;
+ }
+
+ @Override
+ public void apply(DOMStoreWriteTransaction transaction) {
+ transaction.merge(path, data);
+ }
+
+ @Override public Object toSerializable() {
+ NormalizedNodeMessages.Container encode =
+ new NormalizedNodeToNodeCodec(schemaContext).encode(
+ path, data);
+
+ return PersistentMessages.Modification.newBuilder()
+ .setType(this.getClass().toString())
+ .setPath(InstanceIdentifierUtils.toSerializable(this.path))
+ .setData(encode.getNormalizedNode())
+ .build();
+
+ }
+
+ public static MergeModification fromSerializable(
+ Object serializable,
+ SchemaContext schemaContext) {
+ PersistentMessages.Modification o = (PersistentMessages.Modification) serializable;
+
+ YangInstanceIdentifier path = InstanceIdentifierUtils.fromSerializable(o.getPath());
+ NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode(
+ path, o.getData());
+
+ return new MergeModification(path, data, schemaContext);
+ }
- @Override
- public void apply(DOMStoreWriteTransaction transaction) {
- transaction.merge(path, data);
- }
}
package org.opendaylight.controller.cluster.datastore.modification;
+import org.opendaylight.controller.cluster.datastore.messages.SerializableMessage;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
/**
* which can then be applied to a write transaction
* </p>
*/
-public interface Modification {
+public interface Modification extends SerializableMessage {
/**
* Apply the modification to the specified transaction
* @param transaction
package org.opendaylight.controller.cluster.datastore.modification;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
* CompositeModification {@link org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification#addModification(Modification)}
*/
public class MutableCompositeModification
- implements CompositeModification, Serializable {
+ implements CompositeModification {
private static final long serialVersionUID = 1163377899140186790L;
public List<Modification> getModifications() {
return Collections.unmodifiableList(modifications);
}
+
+ @Override public Object toSerializable() {
+ PersistentMessages.CompositeModification.Builder builder =
+ PersistentMessages.CompositeModification.newBuilder();
+
+ for (Modification m : modifications) {
+ builder.addModification(
+ (PersistentMessages.Modification) m.toSerializable());
+ }
+
+ return builder.build();
+ }
+
+ public static MutableCompositeModification fromSerializable(Object serializable, SchemaContext schemaContext){
+ PersistentMessages.CompositeModification o = (PersistentMessages.CompositeModification) serializable;
+ MutableCompositeModification compositeModification = new MutableCompositeModification();
+
+ for(PersistentMessages.Modification m : o.getModificationList()){
+ if(m.getType().equals(DeleteModification.class.toString())){
+ compositeModification.addModification(DeleteModification.fromSerializable(m));
+ } else if(m.getType().equals(WriteModification.class.toString())){
+ compositeModification.addModification(WriteModification.fromSerializable(m, schemaContext));
+ } else if(m.getType().equals(MergeModification.class.toString())){
+ compositeModification.addModification(MergeModification.fromSerializable(m, schemaContext));
+ }
+ }
+
+ return compositeModification;
+ }
}
package org.opendaylight.controller.cluster.datastore.modification;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
/**
* WriteModification stores all the parameters required to write data to the specified path
public class WriteModification extends AbstractModification {
private final NormalizedNode data;
+ private final SchemaContext schemaContext;
- public WriteModification(InstanceIdentifier path, NormalizedNode data) {
+ public WriteModification(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) {
super(path);
this.data = data;
- }
+ this.schemaContext = schemaContext;
+ }
@Override
public void apply(DOMStoreWriteTransaction transaction) {
transaction.write(path, data);
}
+ @Override public Object toSerializable() {
+ NormalizedNodeMessages.Container encode =
+ new NormalizedNodeToNodeCodec(schemaContext).encode(
+ path, data);
+
+
+ return PersistentMessages.Modification.newBuilder()
+ .setType(this.getClass().toString())
+ .setPath(InstanceIdentifierUtils.toSerializable(this.path))
+ .setData(encode.getNormalizedNode())
+ .build();
+
+ }
+
+ public static WriteModification fromSerializable(
+ Object serializable,
+ SchemaContext schemaContext) {
+ PersistentMessages.Modification o = (PersistentMessages.Modification) serializable;
+
+ YangInstanceIdentifier path = InstanceIdentifierUtils.fromSerializable(o.getPath());
+ NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode(
+ path, o.getData());
+
+ return new WriteModification(path, data, schemaContext);
+ }
}
package org.opendaylight.controller.cluster.datastore.shardstrategy;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
* The DefaultShardStrategy basically puts all data into the default Shard
public static final String DEFAULT_SHARD = "default";
@Override
- public String findShard(InstanceIdentifier path) {
+ public String findShard(YangInstanceIdentifier path) {
return DEFAULT_SHARD;
}
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.shardstrategy;
+
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class ModuleShardStrategy implements ShardStrategy {
+
+ public static final String NAME = "module";
+
+ private final String moduleName;
+ private final Configuration configuration;
+
+ public ModuleShardStrategy(String moduleName, Configuration configuration){
+ this.moduleName = moduleName;
+
+ this.configuration = configuration;
+ }
+
+ @Override public String findShard(YangInstanceIdentifier path) {
+ return configuration.getShardNamesFromModuleName(moduleName).get(0);
+ }
+}
package org.opendaylight.controller.cluster.datastore.shardstrategy;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
* The role of ShardStrategy is to figure out which Shards a given piece of data belongs to
* @param path The location of the data in the logical tree
* @return
*/
- String findShard(InstanceIdentifier path);
+ String findShard(YangInstanceIdentifier path);
}
package org.opendaylight.controller.cluster.datastore.shardstrategy;
+import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class ShardStrategyFactory {
- private static final Map<String, ShardStrategy> moduleNameToStrategyMap = new ConcurrentHashMap();
+ private static Map<String, ShardStrategy> moduleNameToStrategyMap =
+ new ConcurrentHashMap();
- private static final String UNKNOWN_MODULE_NAME = "unknown";
+ private static final String UNKNOWN_MODULE_NAME = "unknown";
+ private static Configuration configuration;
- public static ShardStrategy getStrategy(InstanceIdentifier path){
- Preconditions.checkNotNull(path, "path should not be null");
- String moduleName = getModuleName(path);
- ShardStrategy shardStrategy = moduleNameToStrategyMap.get(moduleName);
- if(shardStrategy == null){
- return new DefaultShardStrategy();
+ public static void setConfiguration(Configuration configuration){
+ ShardStrategyFactory.configuration = configuration;
+ moduleNameToStrategyMap = configuration.getModuleNameToShardStrategyMap();
}
- return shardStrategy;
- }
+ public static ShardStrategy getStrategy(YangInstanceIdentifier path) {
+ Preconditions.checkState(configuration != null, "configuration should not be missing");
+ Preconditions.checkNotNull(path, "path should not be null");
- private static String getModuleName(InstanceIdentifier path){
- return UNKNOWN_MODULE_NAME;
- }
+ String moduleName = getModuleName(path);
+ ShardStrategy shardStrategy = moduleNameToStrategyMap.get(moduleName);
+ if (shardStrategy == null) {
+ return new DefaultShardStrategy();
+ }
- /**
- * This is to be used in the future to register a custom shard strategy
- *
- * @param moduleName
- * @param shardStrategy
- */
- public static void registerShardStrategy(String moduleName, ShardStrategy shardStrategy){
- throw new UnsupportedOperationException("registering a custom shard strategy not supported yet");
- }
+ return shardStrategy;
+ }
+
+
+ private static String getModuleName(YangInstanceIdentifier path) {
+ String namespace = path.getPathArguments().iterator().next().getNodeType().getNamespace().toASCIIString();
+
+ Optional<String> optional =
+ configuration.getModuleNameFromNameSpace(namespace);
+
+ if(!optional.isPresent()){
+ return UNKNOWN_MODULE_NAME;
+ }
+
+ return optional.get();
+ }
}
import akka.actor.ActorSystem;
import akka.actor.PoisonPill;
import akka.util.Timeout;
+import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.Configuration;
import org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException;
import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException;
import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.concurrent.Await;
private static final Logger
LOG = LoggerFactory.getLogger(ActorContext.class);
- public static final FiniteDuration ASK_DURATION = Duration.create(5, TimeUnit.SECONDS);
- public static final Duration AWAIT_DURATION = Duration.create(5, TimeUnit.SECONDS);
+ public static final FiniteDuration ASK_DURATION =
+ Duration.create(5, TimeUnit.SECONDS);
+ public static final Duration AWAIT_DURATION =
+ Duration.create(5, TimeUnit.SECONDS);
private final ActorSystem actorSystem;
private final ActorRef shardManager;
+ private final ClusterWrapper clusterWrapper;
+ private final Configuration configuration;
- public ActorContext(ActorSystem actorSystem, ActorRef shardManager){
+ private SchemaContext schemaContext = null;
+
+ public ActorContext(ActorSystem actorSystem, ActorRef shardManager,
+ ClusterWrapper clusterWrapper,
+ Configuration configuration) {
this.actorSystem = actorSystem;
this.shardManager = shardManager;
+ this.clusterWrapper = clusterWrapper;
+ this.configuration = configuration;
}
public ActorSystem getActorSystem() {
return shardManager;
}
- public ActorSelection actorSelection(String actorPath){
+ public ActorSelection actorSelection(String actorPath) {
return actorSystem.actorSelection(actorPath);
}
- public ActorSelection actorSelection(ActorPath actorPath){
+ public ActorSelection actorSelection(ActorPath actorPath) {
return actorSystem.actorSelection(actorPath);
}
* @return
*/
public ActorSelection findPrimary(String shardName) {
+ String path = findPrimaryPath(shardName);
+ return actorSystem.actorSelection(path);
+ }
+
+ public String findPrimaryPath(String shardName) {
Object result = executeLocalOperation(shardManager,
- new FindPrimary(shardName), ASK_DURATION);
+ new FindPrimary(shardName).toSerializable(), ASK_DURATION);
- if(result instanceof PrimaryFound){
- PrimaryFound found = (PrimaryFound) result;
+ if (result.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) {
+ PrimaryFound found = PrimaryFound.fromSerializable(result);
- LOG.error("Primary found {}", found.getPrimaryPath());
+ LOG.debug("Primary found {}", found.getPrimaryPath());
- return actorSystem.actorSelection(found.getPrimaryPath());
+ return found.getPrimaryPath();
}
- throw new PrimaryNotFoundException();
+ throw new PrimaryNotFoundException("Could not find primary for shardName " + shardName);
}
+
/**
* Executes an operation on a local actor and wait for it's response
+ *
* @param actor
* @param message
* @param duration
* @return The response of the operation
*/
public Object executeLocalOperation(ActorRef actor, Object message,
- FiniteDuration duration){
+ FiniteDuration duration) {
Future<Object> future =
ask(actor, message, new Timeout(duration));
try {
return Await.result(future, AWAIT_DURATION);
} catch (Exception e) {
- throw new TimeoutException(e);
+ throw new TimeoutException("Sending message " + message.getClass().toString() + " to actor " + actor.toString() + " failed" , e);
}
}
/**
* Execute an operation on a remote actor and wait for it's response
+ *
* @param actor
* @param message
* @param duration
* @return
*/
public Object executeRemoteOperation(ActorSelection actor, Object message,
- FiniteDuration duration){
+ FiniteDuration duration) {
+
+ LOG.debug("Sending remote message {} to {}", message.getClass().toString(), actor.toString());
+
Future<Object> future =
ask(actor, message, new Timeout(duration));
try {
return Await.result(future, AWAIT_DURATION);
} catch (Exception e) {
- throw new TimeoutException(e);
+ throw new TimeoutException("Sending message " + message.getClass().toString() + " to actor " + actor.toString() + " failed" , e);
}
}
/**
* Execute an operation on the primary for a given shard
* <p>
- * This method first finds the primary for a given shard ,then sends
- * the message to the remote shard and waits for a response
+ * This method first finds the primary for a given shard ,then sends
+ * the message to the remote shard and waits for a response
* </p>
+ *
* @param shardName
* @param message
* @param duration
- * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException if the message to the remote shard times out
- * @throws org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException if the primary shard is not found
- *
* @return
+ * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException if the message to the remote shard times out
+ * @throws org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException if the primary shard is not found
*/
- public Object executeShardOperation(String shardName, Object message, FiniteDuration duration){
+ public Object executeShardOperation(String shardName, Object message,
+ FiniteDuration duration) {
ActorSelection primary = findPrimary(shardName);
return executeRemoteOperation(primary, message, duration);
shardManager.tell(PoisonPill.getInstance(), null);
actorSystem.shutdown();
}
+
+ /**
+ * @deprecated Need to stop using this method. There are ways to send a
+ * remote ActorRef as a string which should be used instead of this hack
+ *
+ * @param primaryPath
+ * @param localPathOfRemoteActor
+ * @return
+ */
+ @Deprecated
+ public String resolvePath(final String primaryPath,
+ final String localPathOfRemoteActor) {
+ StringBuilder builder = new StringBuilder();
+ String[] primaryPathElements = primaryPath.split("/");
+ builder.append(primaryPathElements[0]).append("//")
+ .append(primaryPathElements[1]).append(primaryPathElements[2]);
+ String[] remotePathElements = localPathOfRemoteActor.split("/");
+ for (int i = 3; i < remotePathElements.length; i++) {
+ builder.append("/").append(remotePathElements[i]);
+ }
+
+ return builder.toString();
+
+ }
+
+ public ActorPath actorFor(String path){
+ return actorSystem.actorFor(path).path();
+ }
+
+ public String getCurrentMemberName(){
+ return clusterWrapper.getCurrentMemberName();
+ }
+
}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.utils;
+
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author: syedbahm
+ */
+public class InstanceIdentifierUtils {
+
+ protected static final Logger logger = LoggerFactory
+ .getLogger(InstanceIdentifierUtils.class);
+
+ public static String getParentPath(String currentElementPath) {
+ String parentPath = "";
+
+ if (currentElementPath != null) {
+ String[] parentPaths = currentElementPath.split("/");
+ if (parentPaths.length > 2) {
+ for (int i = 0; i < parentPaths.length - 1; i++) {
+ if (parentPaths[i].length() > 0) {
+ parentPath += "/" + parentPaths[i];
+ }
+ }
+ }
+ }
+ return parentPath;
+ }
+
+ @Deprecated
+ public static YangInstanceIdentifier from(String path) {
+ String[] ids = path.split("/");
+
+ List<YangInstanceIdentifier.PathArgument> pathArguments =
+ new ArrayList<>();
+ for (String nodeId : ids) {
+ if (!"".equals(nodeId)) {
+ pathArguments
+ .add(NodeIdentifierFactory.getArgument(nodeId));
+ }
+ }
+ final YangInstanceIdentifier instanceIdentifier =
+ YangInstanceIdentifier.create(pathArguments);
+ return instanceIdentifier;
+ }
+
+ /**
+ * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils} instead
+ * @param path
+ * @return
+ */
+ @Deprecated
+ public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path){
+ return org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils.toSerializable(path);
+ }
+
+ /**
+ * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils} instead
+ * @param path
+ * @return
+ */
+ @Deprecated
+ public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path){
+ return org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils.fromSerializable(path);
+ }
+}
ODLCluster{
+actor {
+ serializers {
+ java = "akka.serialization.JavaSerializer"
+ proto = "akka.remote.serialization.ProtobufSerializer"
+ }
+
+ serialization-bindings {
+ "com.google.protobuf.Message" = proto
+
+ }
+ }
+
}
\ No newline at end of file
--- /dev/null
+module-shards = [
+ {
+ name = "default"
+ shards = [
+ {
+ name="default",
+ replicas = [
+ "member-1",
+ ]
+ }
+ ]
+ },
+ {
+ name = "inventory"
+ shards = [
+ {
+ name="inventory"
+ replicas = [
+ "member-1",
+ ]
+ }
+ ]
+ }
+
+]
--- /dev/null
+modules = [
+ {
+ name = "inventory"
+ namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people"
+ shard-strategy = "module"
+ }
+]
import akka.actor.ActorSystem;
import akka.testkit.JavaTestKit;
+import org.apache.commons.io.FileUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import java.io.File;
+import java.io.IOException;
+
public abstract class AbstractActorTest {
private static ActorSystem system;
@BeforeClass
- public static void setUpClass() {
+ public static void setUpClass() throws IOException {
+ File journal = new File("journal");
+
+ if(journal.exists()) {
+ FileUtils.deleteDirectory(journal);
+ }
+
System.setProperty("shard.persistent", "false");
system = ActorSystem.create("test");
}
@AfterClass
- public static void tearDownClass() {
+ public static void tearDownClass() throws IOException {
JavaTestKit.shutdownActorSystem(system);
system = null;
+
+ File journal = new File("journal");
+
+ if(journal.exists()) {
+ FileUtils.deleteDirectory(journal);
+ }
}
protected ActorSystem getSystem() {
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.Props;
-import akka.actor.Terminated;
import akka.testkit.JavaTestKit;
import junit.framework.Assert;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
import scala.concurrent.Future;
import scala.concurrent.duration.FiniteDuration;
+import java.util.Collections;
+
public class BasicIntegrationTest extends AbstractActorTest {
@Test
public void integrationTest() throws Exception{
+ // System.setProperty("shard.persistent", "true");
// This test will
// - create a Shard
// - initiate a transaction
new JavaTestKit(getSystem()) {{
- final Props props = Shard.props("config");
+ final Props props = Shard.props("config", Collections.EMPTY_MAP);
final ActorRef shard = getSystem().actorOf(props);
new Within(duration("5 seconds")) {
protected void run() {
+
shard.tell(
new UpdateSchemaContext(TestModel.createTestContext()),
getRef());
- shard.tell(new CreateTransactionChain(), getRef());
+
+ // Wait for Shard to become a Leader
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // 1. Create a TransactionChain
+ shard.tell(new CreateTransactionChain().toSerializable(), getRef());
final ActorSelection transactionChain =
new ExpectMsg<ActorSelection>("CreateTransactionChainReply") {
protected ActorSelection match(Object in) {
- if (in instanceof CreateTransactionChainReply) {
+ if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)) {
ActorPath transactionChainPath =
- ((CreateTransactionChainReply) in)
+ CreateTransactionChainReply.fromSerializable(getSystem(),in)
.getTransactionChainPath();
return getSystem()
.actorSelection(transactionChainPath);
Assert.assertNotNull(transactionChain);
- transactionChain.tell(new CreateTransaction("txn-1"), getRef());
+ System.out.println("Successfully created transaction chain");
+
+ // 2. Create a Transaction on the TransactionChain
+ transactionChain.tell(new CreateTransaction("txn-1").toSerializable(), getRef());
final ActorSelection transaction =
new ExpectMsg<ActorSelection>("CreateTransactionReply") {
protected ActorSelection match(Object in) {
- if (in instanceof CreateTransactionReply) {
- ActorPath transactionPath =
- ((CreateTransactionReply) in)
- .getTransactionPath();
+ if (CreateTransactionReply.SERIALIZABLE_CLASS.equals(in.getClass())) {
+ CreateTransactionReply reply = CreateTransactionReply.fromSerializable(in);
return getSystem()
- .actorSelection(transactionPath);
+ .actorSelection(reply
+ .getTransactionPath());
} else {
throw noMatch();
}
Assert.assertNotNull(transaction);
- // Add a watch on the transaction actor so that we are notified when it dies
- final ActorRef transactionActorRef = watchActor(transaction);
+ System.out.println("Successfully created transaction");
+ // 3. Write some data
transaction.tell(new WriteData(TestModel.TEST_PATH,
- ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+ ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()).toSerializable(),
getRef());
Boolean writeDone = new ExpectMsg<Boolean>("WriteDataReply") {
protected Boolean match(Object in) {
- if (in instanceof WriteDataReply) {
+ if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) {
return true;
} else {
throw noMatch();
Assert.assertTrue(writeDone);
- transaction.tell(new ReadyTransaction(), getRef());
+ System.out.println("Successfully wrote data");
+
+ // 4. Ready the transaction for commit
+
+ transaction.tell(new ReadyTransaction().toSerializable(), getRef());
final ActorSelection cohort =
new ExpectMsg<ActorSelection>("ReadyTransactionReply") {
protected ActorSelection match(Object in) {
- if (in instanceof ReadyTransactionReply) {
+ if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) {
ActorPath cohortPath =
- ((ReadyTransactionReply) in)
+ ReadyTransactionReply.fromSerializable(getSystem(),in)
.getCohortPath();
return getSystem()
.actorSelection(cohortPath);
Assert.assertNotNull(cohort);
- // Add a watch on the transaction actor so that we are notified when it dies
- final ActorRef cohorActorRef = watchActor(cohort);
+ System.out.println("Successfully readied the transaction");
- cohort.tell(new PreCommitTransaction(), getRef());
+ // 5. PreCommit the transaction
+
+ cohort.tell(new PreCommitTransaction().toSerializable(), getRef());
Boolean preCommitDone =
new ExpectMsg<Boolean>("PreCommitTransactionReply") {
protected Boolean match(Object in) {
- if (in instanceof PreCommitTransactionReply) {
+ if (in.getClass().equals(PreCommitTransactionReply.SERIALIZABLE_CLASS)) {
return true;
} else {
throw noMatch();
Assert.assertTrue(preCommitDone);
- // FIXME : When we commit on the cohort it "kills" the Transaction.
- // This in turn kills the child of Transaction as well.
- // The order in which we receive the terminated event for both
- // these actors is not fixed which may cause this test to fail
- cohort.tell(new CommitTransaction(), getRef());
-
- final Boolean terminatedCohort =
- new ExpectMsg<Boolean>("Terminated Cohort") {
- protected Boolean match(Object in) {
- if (in instanceof Terminated) {
- return cohorActorRef.equals(((Terminated) in).actor());
- } else {
- throw noMatch();
- }
- }
- }.get(); // this extracts the received message
-
- Assert.assertTrue(terminatedCohort);
-
+ System.out.println("Successfully pre-committed the transaction");
- final Boolean terminatedTransaction =
- new ExpectMsg<Boolean>("Terminated Transaction") {
- protected Boolean match(Object in) {
- if (in instanceof Terminated) {
- return transactionActorRef.equals(((Terminated) in).actor());
- } else {
- throw noMatch();
- }
- }
- }.get(); // this extracts the received message
-
- Assert.assertTrue(terminatedTransaction);
-
- final Boolean commitDone =
- new ExpectMsg<Boolean>("CommitTransactionReply") {
- protected Boolean match(Object in) {
- if (in instanceof CommitTransactionReply) {
- return true;
- } else {
- throw noMatch();
- }
- }
- }.get(); // this extracts the received message
+ // 6. Commit the transaction
+ cohort.tell(new CommitTransaction().toSerializable(), getRef());
- Assert.assertTrue(commitDone);
+ // FIXME : Add assertions that the commit worked and that the cohort and transaction actors were terminated
+ System.out.println("TODO : Check Successfully committed the transaction");
}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore;
+
+import com.typesafe.config.ConfigFactory;
+import junit.framework.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+
+public class ConfigurationImplTest {
+
+ private static ConfigurationImpl configuration;
+
+ @BeforeClass
+ public static void staticSetup(){
+ configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+ }
+
+ @Test
+ public void testConstructor(){
+ Assert.assertNotNull(configuration);
+ }
+
+ @Test
+ public void testGetMemberShardNames(){
+ List<String> memberShardNames =
+ configuration.getMemberShardNames("member-1");
+
+ assertTrue(memberShardNames.contains("people-1"));
+ assertTrue(memberShardNames.contains("cars-1"));
+ }
+
+ @Test
+ public void testReadConfigurationFromFile(){
+ File f = new File("./module-shards.conf");
+ ConfigFactory.parseFile(f);
+ }
+}
+
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorRef;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
+import org.opendaylight.controller.md.cluster.datastore.model.CompositeModel;
+import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class DataChangeListenerProxyTest extends AbstractActorTest {
- private static class MockDataChangeEvent implements
- AsyncDataChangeEvent<InstanceIdentifier,NormalizedNode<?,?>> {
+ private static class MockDataChangedEvent implements AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
+ Map<YangInstanceIdentifier,NormalizedNode<?,?>> createdData = new HashMap();
+ Map<YangInstanceIdentifier,NormalizedNode<?,?>> updatedData = new HashMap();
+ Map<YangInstanceIdentifier,NormalizedNode<?,?>> originalData = new HashMap();
+
+
+
+ @Override
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+ createdData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createDocumentOne(CompositeModel.createTestContext()));
+ return createdData;
+ }
- @Override
- public Map<InstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
- throw new UnsupportedOperationException("getCreatedData");
- }
+ @Override
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+ updatedData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createTestContainer());
+ return updatedData;
- @Override
- public Map<InstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
- throw new UnsupportedOperationException("getUpdatedData");
- }
+ }
- @Override public Set<InstanceIdentifier> getRemovedPaths() {
- throw new UnsupportedOperationException("getRemovedPaths");
- }
+ @Override
+ public Set<YangInstanceIdentifier> getRemovedPaths() {
+ Set<YangInstanceIdentifier>ids = new HashSet();
+ ids.add( CompositeModel.TEST_PATH);
+ return ids;
+ }
- @Override
- public Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> getOriginalData() {
- throw new UnsupportedOperationException("getOriginalData");
- }
+ @Override
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
+ originalData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createFamily());
+ return originalData;
+ }
- @Override public NormalizedNode<?, ?> getOriginalSubtree() {
- throw new UnsupportedOperationException("getOriginalSubtree");
- }
+ @Override public NormalizedNode<?, ?> getOriginalSubtree() {
+ return CompositeModel.createFamily() ;
+ }
- @Override public NormalizedNode<?, ?> getUpdatedSubtree() {
- throw new UnsupportedOperationException("getUpdatedSubtree");
- }
+ @Override public NormalizedNode<?, ?> getUpdatedSubtree() {
+ return CompositeModel.createTestContainer();
}
+ }
+
- @Test
+ @Test
public void testOnDataChanged() throws Exception {
final Props props = Props.create(MessageCollectorActor.class);
final ActorRef actorRef = getSystem().actorOf(props);
DataChangeListenerProxy dataChangeListenerProxy =
- new DataChangeListenerProxy(
+ new DataChangeListenerProxy(TestModel.createTestContext(),
getSystem().actorSelection(actorRef.path()));
- dataChangeListenerProxy.onDataChanged(new MockDataChangeEvent());
+ dataChangeListenerProxy.onDataChanged(new MockDataChangedEvent());
//Check if it was received by the remote actor
ActorContext
- testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
+ testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration());
Object messages = testContext
.executeLocalOperation(actorRef, "messages",
ActorContext.ASK_DURATION);
Assert.assertEquals(1, listMessages.size());
- Assert.assertTrue(listMessages.get(0) instanceof DataChanged);
+ Assert.assertTrue(listMessages.get(0).getClass().equals(DataChanged.SERIALIZABLE_CLASS));
}
}
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import java.util.List;
private ActorRef dataChangeListenerActor = getSystem().actorOf(Props.create(DoNothingActor.class));
private static class MockDataChangeListener implements
- AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+ AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
@Override public void onDataChanged(
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
throw new UnsupportedOperationException("onDataChanged");
}
}
//Check if it was received by the remote actor
ActorContext
- testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
+ testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)),new MockClusterWrapper(), new MockConfiguration());
Object messages = testContext
.executeLocalOperation(actorRef, "messages",
ActorContext.ASK_DURATION);
Assert.assertEquals(1, listMessages.size());
- Assert.assertTrue(listMessages.get(0) instanceof CloseDataChangeListenerRegistration);
+ Assert.assertTrue(listMessages.get(0).getClass().equals(CloseDataChangeListenerRegistration.SERIALIZABLE_CLASS));
}
}
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import static org.junit.Assert.assertEquals;
new Within(duration("1 seconds")) {
protected void run() {
- subject.tell(new CloseDataChangeListenerRegistration(), getRef());
+ subject.tell(new CloseDataChangeListenerRegistration().toSerializable(), getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof CloseDataChangeListenerRegistrationReply) {
+ if (in.getClass().equals(CloseDataChangeListenerRegistrationReply.SERIALIZABLE_CLASS)) {
return "match";
} else {
throw noMatch();
}};
}
- private AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener(){
- return new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
+ private AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener(){
+ return new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
@Override
- public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+ public void onDataChanged(AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
}
};
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
import org.opendaylight.controller.cluster.datastore.messages.DataChangedReply;
+import org.opendaylight.controller.md.cluster.datastore.model.CompositeModel;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class DataChangeListenerTest extends AbstractActorTest {
- private static class MockDataChangedEvent implements AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> {
+ private static class MockDataChangedEvent implements AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
+ Map<YangInstanceIdentifier,NormalizedNode<?,?>> createdData = new HashMap();
+ Map<YangInstanceIdentifier,NormalizedNode<?,?>> updatedData = new HashMap();
+ Map<YangInstanceIdentifier,NormalizedNode<?,?>> originalData = new HashMap();
+
+
@Override
- public Map<InstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
- throw new UnsupportedOperationException("getCreatedData");
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+ createdData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
+ return createdData;
}
@Override
- public Map<InstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
- throw new UnsupportedOperationException("getUpdatedData");
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+ updatedData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
+ return updatedData;
+
}
- @Override public Set<InstanceIdentifier> getRemovedPaths() {
- throw new UnsupportedOperationException("getRemovedPaths");
+ @Override
+ public Set<YangInstanceIdentifier> getRemovedPaths() {
+ Set<YangInstanceIdentifier>ids = new HashSet();
+ ids.add( CompositeModel.TEST_PATH);
+ return ids;
}
@Override
- public Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> getOriginalData() {
- throw new UnsupportedOperationException("getOriginalData");
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
+ originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
+ return originalData;
}
@Override public NormalizedNode<?, ?> getOriginalSubtree() {
- throw new UnsupportedOperationException("getOriginalSubtree");
+
+
+ return originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
}
@Override public NormalizedNode<?, ?> getUpdatedSubtree() {
- throw new UnsupportedOperationException("getUpdatedSubtree");
+
+ //fixme: need to have some valid data here
+ return originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
}
}
- private class MockDataChangeListener implements AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+ private class MockDataChangeListener implements AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
private boolean gotIt = false;
+ private AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change;
@Override public void onDataChanged(
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
- gotIt = true;
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
+ gotIt = true;this.change=change;
}
public boolean gotIt() {
return gotIt;
}
+ public AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> getChange(){
+ return change;
+ }
}
@Test
public void testDataChanged(){
new JavaTestKit(getSystem()) {{
final MockDataChangeListener listener = new MockDataChangeListener();
- final Props props = DataChangeListener.props(listener);
+ final Props props = DataChangeListener.props(CompositeModel.createTestContext(),listener,CompositeModel.FAMILY_PATH );
final ActorRef subject =
getSystem().actorOf(props, "testDataChanged");
protected void run() {
subject.tell(
- new DataChanged(new MockDataChangedEvent()),
+ new DataChanged(CompositeModel.createTestContext(),new MockDataChangedEvent()).toSerializable(),
getRef());
final Boolean out = new ExpectMsg<Boolean>("dataChanged") {
// do not put code outside this method, will run afterwards
protected Boolean match(Object in) {
- if (in instanceof DataChangedReply) {
- DataChangedReply reply =
- (DataChangedReply) in;
+ if (in.getClass().equals(DataChangedReply.SERIALIZABLE_CLASS)) {
+
return true;
} else {
throw noMatch();
assertTrue(out);
assertTrue(listener.gotIt());
+ assertNotNull(listener.getChange().getCreatedData());
// Will wait for the rest of the 3 seconds
expectNoMsg();
}
package org.opendaylight.controller.cluster.datastore;
+import akka.actor.ActorSystem;
+import akka.testkit.JavaTestKit;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.ListenableFuture;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
+import org.opendaylight.controller.md.cluster.datastore.model.PeopleModel;
+import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import java.util.concurrent.ExecutionException;
+
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
-public class DistributedDataStoreIntegrationTest extends AbstractActorTest {
+public class DistributedDataStoreIntegrationTest{
+
+ private static ActorSystem system;
+
+ @Before
+ public void setUp() {
+ System.setProperty("shard.persistent", "false");
+ system = ActorSystem.create("test");
+ }
+
+ @After
+ public void tearDown() {
+ JavaTestKit.shutdownActorSystem(system);
+ system = null;
+ }
+
+ protected ActorSystem getSystem() {
+ return system;
+ }
@Test
public void integrationTest() throws Exception {
+ Configuration configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+ ShardStrategyFactory.setConfiguration(configuration);
DistributedDataStore distributedDataStore =
- new DistributedDataStore(getSystem(), "config");
+ new DistributedDataStore(getSystem(), "config", new MockClusterWrapper(), configuration);
distributedDataStore.onGlobalContextUpdated(TestModel.createTestContext());
+ Thread.sleep(1000);
+
DOMStoreReadWriteTransaction transaction =
distributedDataStore.newReadWriteTransaction();
}
+
+ @Test
+ public void integrationTestWithMultiShardConfiguration()
+ throws ExecutionException, InterruptedException {
+ Configuration configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+
+ ShardStrategyFactory.setConfiguration(configuration);
+ DistributedDataStore distributedDataStore =
+ new DistributedDataStore(getSystem(), "config", new MockClusterWrapper(), configuration);
+
+
+ distributedDataStore.onGlobalContextUpdated(SchemaContextHelper.full());
+
+ Thread.sleep(1000);
+
+ DOMStoreReadWriteTransaction transaction =
+ distributedDataStore.newReadWriteTransaction();
+
+ transaction.write(CarsModel.BASE_PATH, CarsModel.emptyContainer());
+ transaction.write(PeopleModel.BASE_PATH, PeopleModel.emptyContainer());
+
+ DOMStoreThreePhaseCommitCohort ready = transaction.ready();
+
+ ListenableFuture<Boolean> canCommit = ready.canCommit();
+
+ assertTrue(canCommit.get());
+
+ ListenableFuture<Void> preCommit = ready.preCommit();
+
+ preCommit.get();
+
+ ListenableFuture<Void> commit = ready.commit();
+
+ commit.get();
+
+ }
+
}
import akka.actor.ActorRef;
import akka.actor.Props;
import junit.framework.Assert;
-import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
import org.opendaylight.controller.cluster.datastore.utils.MockActorContext;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public class DistributedDataStoreTest extends AbstractActorTest{
@org.junit.Before
public void setUp() throws Exception {
+ ShardStrategyFactory.setConfiguration(new MockConfiguration());
final Props props = Props.create(DoNothingActor.class);
doNothingActorRef = getSystem().actorOf(props);
// Make CreateTransactionReply as the default response. Will need to be
// tuned if a specific test requires some other response
mockActorContext.setExecuteShardOperationResponse(
- new CreateTransactionReply(doNothingActorRef.path(), "txn-1 "));
+ CreateTransactionReply.newBuilder()
+ .setTransactionActorPath(doNothingActorRef.path().toString())
+ .setTransactionId("txn-1 ")
+ .build());
}
@org.junit.After
@org.junit.Test
public void testRegisterChangeListener() throws Exception {
- mockActorContext.setExecuteShardOperationResponse(new RegisterChangeListenerReply(doNothingActorRef.path()));
+ mockActorContext.setExecuteShardOperationResponse(new RegisterChangeListenerReply(doNothingActorRef.path()).toSerializable());
ListenerRegistration registration =
- distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
+ distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
@Override
- public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+ public void onDataChanged(AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
throw new UnsupportedOperationException("onDataChanged");
}
}, AsyncDataBroker.DataChangeScope.BASE);
import akka.actor.Props;
import akka.testkit.JavaTestKit;
import akka.testkit.TestActorRef;
+import junit.framework.Assert;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
import scala.concurrent.duration.Duration;
public class ShardManagerTest {
private static ActorSystem system;
@BeforeClass
- public static void setUp(){
+ public static void setUp() {
system = ActorSystem.create("test");
}
@AfterClass
- public static void tearDown(){
+ public static void tearDown() {
JavaTestKit.shutdownActorSystem(system);
system = null;
}
public void testOnReceiveFindPrimaryForNonExistentShard() throws Exception {
new JavaTestKit(system) {{
- final Props props = ShardManager.props("config");
- final TestActorRef<ShardManager> subject = TestActorRef.create(system, props);
+ final Props props = ShardManager
+ .props("config", new MockClusterWrapper(),
+ new MockConfiguration());
+ final TestActorRef<ShardManager> subject =
+ TestActorRef.create(system, props);
new Within(duration("1 seconds")) {
protected void run() {
- subject.tell(new FindPrimary("inventory"), getRef());
+ subject.tell(new FindPrimary("inventory").toSerializable(), getRef());
- expectMsgEquals(Duration.Zero(), new PrimaryNotFound("inventory"));
+ expectMsgEquals(Duration.Zero(),
+ new PrimaryNotFound("inventory").toSerializable());
// Will wait for the rest of the 3 seconds
expectNoMsg();
}};
}
- @Test
- public void testOnReceiveFindPrimaryForExistentShard() throws Exception {
+ @Test
+ public void testOnReceiveFindPrimaryForExistentShard() throws Exception {
+
+ new JavaTestKit(system) {{
+ final Props props = ShardManager
+ .props("config", new MockClusterWrapper(),
+ new MockConfiguration());
+ final TestActorRef<ShardManager> subject =
+ TestActorRef.create(system, props);
+
+ // the run() method needs to finish within 3 seconds
+ new Within(duration("1 seconds")) {
+ protected void run() {
+
+ subject.tell(new FindPrimary(Shard.DEFAULT_NAME).toSerializable(), getRef());
+
+ expectMsgClass(PrimaryFound.SERIALIZABLE_CLASS);
+
+ expectNoMsg();
+ }
+ };
+ }};
+ }
+
+ @Test
+ public void testOnReceiveMemberUp() throws Exception {
+
+ new JavaTestKit(system) {{
+ final Props props = ShardManager
+ .props("config", new MockClusterWrapper(),
+ new MockConfiguration());
+ final TestActorRef<ShardManager> subject =
+ TestActorRef.create(system, props);
- new JavaTestKit(system) {{
- final Props props = ShardManager.props("config");
- final TestActorRef<ShardManager> subject = TestActorRef.create(system, props);
+ // the run() method needs to finish within 3 seconds
+ new Within(duration("1 seconds")) {
+ protected void run() {
+
+ MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
- // the run() method needs to finish within 3 seconds
- new Within(duration("1 seconds")) {
- protected void run() {
+ subject.tell(new FindPrimary("astronauts").toSerializable(), getRef());
- subject.tell(new FindPrimary(Shard.DEFAULT_NAME), getRef());
+ final String out = new ExpectMsg<String>("primary found") {
+ // do not put code outside this method, will run afterwards
+ protected String match(Object in) {
+ if (in.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) {
+ PrimaryFound f = PrimaryFound.fromSerializable(in);
+ return f.getPrimaryPath();
+ } else {
+ throw noMatch();
+ }
+ }
+ }.get(); // this extracts the received message
+
+ Assert.assertTrue(out, out.contains("member-2-shard-astronauts-config"));
+
+ expectNoMsg();
+ }
+ };
+ }};
+ }
+
+ @Test
+ public void testOnReceiveMemberDown() throws Exception {
+
+ new JavaTestKit(system) {{
+ final Props props = ShardManager
+ .props("config", new MockClusterWrapper(),
+ new MockConfiguration());
+ final TestActorRef<ShardManager> subject =
+ TestActorRef.create(system, props);
+
+ // the run() method needs to finish within 3 seconds
+ new Within(duration("1 seconds")) {
+ protected void run() {
+
+ MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
+
+ subject.tell(new FindPrimary("astronauts").toSerializable(), getRef());
+
+ expectMsgClass(PrimaryFound.SERIALIZABLE_CLASS);
+
+ MockClusterWrapper.sendMemberRemoved(subject, "member-2", getRef().path().toString());
+
+ subject.tell(new FindPrimary("astronauts").toSerializable(), getRef());
+
+ expectMsgClass(PrimaryNotFound.SERIALIZABLE_CLASS);
+
+ expectNoMsg();
+ }
+ };
+ }};
+ }
- expectMsgClass(PrimaryFound.class);
- expectNoMsg();
- }
- };
- }};
- }
-}
\ No newline at end of file
+}
import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
-import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
+import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@Test
public void testOnReceiveCreateTransactionChain() throws Exception {
new JavaTestKit(getSystem()) {{
- final Props props = Shard.props("config");
+ final Props props = Shard.props("config", Collections.EMPTY_MAP);
final ActorRef subject =
getSystem().actorOf(props, "testCreateTransactionChain");
+
+ // Wait for Shard to become a Leader
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
new Within(duration("1 seconds")) {
protected void run() {
- subject.tell(new CreateTransactionChain(), getRef());
+ subject.tell(new CreateTransactionChain().toSerializable(), getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof CreateTransactionChainReply) {
+ if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)){
CreateTransactionChainReply reply =
- (CreateTransactionChainReply) in;
+ CreateTransactionChainReply.fromSerializable(getSystem(),in);
return reply.getTransactionChainPath()
.toString();
} else {
@Test
public void testOnReceiveRegisterListener() throws Exception {
new JavaTestKit(getSystem()) {{
- final Props props = Shard.props("config");
+ final Props props = Shard.props("config", Collections.EMPTY_MAP);
final ActorRef subject =
getSystem().actorOf(props, "testRegisterChangeListener");
protected void run() {
subject.tell(
- new UpdateSchemaContext(TestModel.createTestContext()),
+ new UpdateSchemaContext(SchemaContextHelper.full()),
getRef());
subject.tell(new RegisterChangeListener(TestModel.TEST_PATH,
- getRef().path(), AsyncDataBroker.DataChangeScope.BASE),
+ getRef().path(), AsyncDataBroker.DataChangeScope.BASE).toSerializable(),
getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof RegisterChangeListenerReply) {
+ if (in.getClass().equals(RegisterChangeListenerReply.SERIALIZABLE_CLASS)) {
RegisterChangeListenerReply reply =
- (RegisterChangeListenerReply) in;
+ RegisterChangeListenerReply.fromSerializable(getSystem(),in);
return reply.getListenerRegistrationPath()
.toString();
} else {
@Test
public void testCreateTransaction(){
new JavaTestKit(getSystem()) {{
- final Props props = Shard.props("config");
+ final Props props = Shard.props("config", Collections.EMPTY_MAP);
final ActorRef subject =
getSystem().actorOf(props, "testCreateTransaction");
+
+ // Wait for Shard to become a Leader
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+
new Within(duration("1 seconds")) {
protected void run() {
new UpdateSchemaContext(TestModel.createTestContext()),
getRef());
- subject.tell(new CreateTransaction("txn-1"),
+ subject.tell(new CreateTransaction("txn-1").toSerializable(),
getRef());
final String out = new ExpectMsg<String>("match hint") {
if (in instanceof CreateTransactionReply) {
CreateTransactionReply reply =
(CreateTransactionReply) in;
- return reply.getTransactionPath()
+ return reply.getTransactionActorPath()
.toString();
} else {
throw noMatch();
}
}.get(); // this extracts the received message
- assertEquals("Unexpected transaction path " + out,
- "akka://test/user/testCreateTransaction/shard-txn-1",
- out);
+ assertTrue("Unexpected transaction path " + out,
+ out.contains("akka://test/user/testCreateTransaction/shard-txn-1"));
expectNoMsg();
}
}};
}
+ @Test
+ public void testPeerAddressResolved(){
+ new JavaTestKit(getSystem()) {{
+ Map<String, String> peerAddresses = new HashMap<>();
+ peerAddresses.put("member-2", null);
+ final Props props = Shard.props("config", peerAddresses);
+ final ActorRef subject =
+ getSystem().actorOf(props, "testPeerAddressResolved");
+ new Within(duration("1 seconds")) {
+ protected void run() {
+
+ subject.tell(
+ new PeerAddressResolved("member-2", "akka://foobar"),
+ getRef());
+
+ expectNoMsg();
+ }
+
+
+ };
+ }};
+ }
- private AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener() {
- return new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
+ private AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener() {
+ return new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
@Override
public void onDataChanged(
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
}
};
@Test
public void testOnReceiveCreateTransaction() throws Exception {
new JavaTestKit(getSystem()) {{
- final Props props = ShardTransactionChain.props(store.createTransactionChain());
+ final Props props = ShardTransactionChain.props(store.createTransactionChain(), TestModel.createTestContext());
final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction");
- new Within(duration("1 seconds")) {
+ new Within(duration("1 seconds")) {
protected void run() {
- subject.tell(new CreateTransaction("txn-1"), getRef());
+ subject.tell(new CreateTransaction("txn-1").toSerializable(), getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof CreateTransactionReply) {
- return ((CreateTransactionReply) in).getTransactionPath().toString();
- } else {
+ if (in.getClass().equals(CreateTransactionReply.SERIALIZABLE_CLASS)) {
+ return CreateTransactionReply.fromSerializable(in).getTransactionPath();
+ }else{
throw noMatch();
}
}
}.get(); // this extracts the received message
- assertEquals("Unexpected transaction path " + out,
- "akka://test/user/testCreateTransaction/shard-txn-1",
- out);
+ assertEquals("Unexpected transaction path " + out,
+ "akka://test/user/testCreateTransaction/shard-txn-1",
+ out);
- // Will wait for the rest of the 3 seconds
+ // Will wait for the rest of the 3 seconds
expectNoMsg();
}
@Test
public void testOnReceiveCloseTransactionChain() throws Exception {
new JavaTestKit(getSystem()) {{
- final Props props = ShardTransactionChain.props(store.createTransactionChain());
+ final Props props = ShardTransactionChain.props(store.createTransactionChain(), TestModel.createTestContext());
final ActorRef subject = getSystem().actorOf(props, "testCloseTransactionChain");
new Within(duration("1 seconds")) {
protected void run() {
- subject.tell(new CloseTransactionChain(), getRef());
+ subject.tell(new CloseTransactionChain().toSerializable(), getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof CloseTransactionChainReply) {
+ if (in.getClass().equals(CloseTransactionChainReply.SERIALIZABLE_CLASS)) {
return "match";
} else {
throw noMatch();
import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+import java.util.Collections;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
private static final InMemoryDOMDataStore store =
new InMemoryDOMDataStore("OPER", storeExecutor);
+ private static final SchemaContext testSchemaContext = TestModel.createTestContext();
+
static {
- store.onGlobalContextUpdated(TestModel.createTestContext());
+ store.onGlobalContextUpdated(testSchemaContext);
}
@Test
public void testOnReceiveReadData() throws Exception {
new JavaTestKit(getSystem()) {{
- final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+ final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
final ActorRef subject = getSystem().actorOf(props, "testReadData");
new Within(duration("1 seconds")) {
protected void run() {
subject.tell(
- new ReadData(InstanceIdentifier.builder().build()),
+ new ReadData(YangInstanceIdentifier.builder().build()).toSerializable(),
getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof ReadDataReply) {
- if (((ReadDataReply) in).getNormalizedNode()
- != null) {
+ if (in.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)) {
+ if (ReadDataReply.fromSerializable(testSchemaContext,YangInstanceIdentifier.builder().build(), in)
+ .getNormalizedNode()!= null) {
return "match";
}
return null;
@Test
public void testOnReceiveReadDataWhenDataNotFound() throws Exception {
new JavaTestKit(getSystem()) {{
- final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+ final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
final ActorRef subject = getSystem().actorOf(props, "testReadDataWhenDataNotFound");
new Within(duration("1 seconds")) {
protected void run() {
subject.tell(
- new ReadData(TestModel.TEST_PATH),
+ new ReadData(TestModel.TEST_PATH).toSerializable(),
getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof ReadDataReply) {
- if (((ReadDataReply) in).getNormalizedNode()
+ if (in.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)) {
+ if (ReadDataReply.fromSerializable(testSchemaContext,TestModel.TEST_PATH, in)
+ .getNormalizedNode()
== null) {
return "match";
}
@Test
public void testOnReceiveWriteData() throws Exception {
new JavaTestKit(getSystem()) {{
- final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+ final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
final ActorRef subject =
getSystem().actorOf(props, "testWriteData");
protected void run() {
subject.tell(new WriteData(TestModel.TEST_PATH,
- ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+ ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()).toSerializable(),
getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof WriteDataReply) {
+ if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) {
return "match";
} else {
throw noMatch();
@Test
public void testOnReceiveMergeData() throws Exception {
new JavaTestKit(getSystem()) {{
- final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+ final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
final ActorRef subject =
getSystem().actorOf(props, "testMergeData");
protected void run() {
subject.tell(new MergeData(TestModel.TEST_PATH,
- ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+ ImmutableNodes.containerNode(TestModel.TEST_QNAME), testSchemaContext).toSerializable(),
getRef());
- final String out = new ExpectMsg<String>("match hint") {
+ final String out = new ExpectMsg<String>(duration("500 milliseconds"), "match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof MergeDataReply) {
+ if (in.getClass().equals(MergeDataReply.SERIALIZABLE_CLASS)) {
return "match";
} else {
throw noMatch();
@Test
public void testOnReceiveDeleteData() throws Exception {
new JavaTestKit(getSystem()) {{
- final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+ final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
final ActorRef subject =
getSystem().actorOf(props, "testDeleteData");
new Within(duration("1 seconds")) {
protected void run() {
- subject.tell(new DeleteData(TestModel.TEST_PATH), getRef());
+ subject.tell(new DeleteData(TestModel.TEST_PATH).toSerializable(), getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof DeleteDataReply) {
+ if (in.getClass().equals(DeleteDataReply.SERIALIZABLE_CLASS)) {
return "match";
} else {
throw noMatch();
@Test
public void testOnReceiveReadyTransaction() throws Exception {
new JavaTestKit(getSystem()) {{
- final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+ final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
final ActorRef subject =
getSystem().actorOf(props, "testReadyTransaction");
new Within(duration("1 seconds")) {
protected void run() {
- subject.tell(new ReadyTransaction(), getRef());
+ subject.tell(new ReadyTransaction().toSerializable(), getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof ReadyTransactionReply) {
+ if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) {
return "match";
} else {
throw noMatch();
@Test
public void testOnReceiveCloseTransaction() throws Exception {
new JavaTestKit(getSystem()) {{
- final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+ final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
final Props props =
- ShardTransaction.props(store.newReadWriteTransaction(), shard);
+ ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
final ActorRef subject =
getSystem().actorOf(props, "testCloseTransaction");
new Within(duration("2 seconds")) {
protected void run() {
- subject.tell(new CloseTransaction(), getRef());
+ subject.tell(new CloseTransaction().toSerializable(), getRef());
final String out = new ExpectMsg<String>("match hint") {
// do not put code outside this method, will run afterwards
protected String match(Object in) {
- if (in instanceof CloseTransactionReply) {
+ if (in.getClass().equals(CloseTransactionReply.SERIALIZABLE_CLASS)) {
return "match";
} else {
throw noMatch();
@Test
public void testCanCommit() throws Exception {
- actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true));
+ actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true).toSerializable());
ListenableFuture<Boolean> future = proxy.canCommit();
@Test
public void testPreCommit() throws Exception {
- actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply());
+ actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply().toSerializable());
ListenableFuture<Void> future = proxy.preCommit();
@Test
public void testAbort() throws Exception {
- actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply());
+ actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply().toSerializable());
ListenableFuture<Void> future = proxy.abort();
@Test
public void testCommit() throws Exception {
- actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply());
+ actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply().toSerializable());
ListenableFuture<Void> future = proxy.commit();
import com.google.common.base.Optional;
import com.google.common.util.concurrent.ListenableFuture;
import junit.framework.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
import org.opendaylight.controller.cluster.datastore.messages.MergeData;
+import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
import org.opendaylight.controller.cluster.datastore.messages.ReadDataReply;
import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.WriteData;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor;
import org.opendaylight.controller.cluster.datastore.utils.MockActorContext;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
public class TransactionProxyTest extends AbstractActorTest {
+ private final Configuration configuration = new MockConfiguration();
+
+ private final ActorContext testContext =
+ new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockClusterWrapper(), configuration );
+
private ExecutorService transactionExecutor =
Executors.newSingleThreadExecutor();
+ @Before
+ public void setUp(){
+ ShardStrategyFactory.setConfiguration(configuration);
+ }
+
@Test
public void testRead() throws Exception {
final Props props = Props.create(DoNothingActor.class);
final ActorRef actorRef = getSystem().actorOf(props);
final MockActorContext actorContext = new MockActorContext(this.getSystem());
+ actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
actorContext.setExecuteRemoteOperationResponse("message");
+
TransactionProxy transactionProxy =
new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
ListenableFuture<Optional<NormalizedNode<?, ?>>> read =
Assert.assertFalse(normalizedNodeOptional.isPresent());
actorContext.setExecuteRemoteOperationResponse(new ReadDataReply(
- ImmutableNodes.containerNode(TestModel.TEST_QNAME)));
+ TestModel.createTestContext(),ImmutableNodes.containerNode(TestModel.TEST_QNAME)).toSerializable());
read = transactionProxy.read(TestModel.TEST_PATH);
final ActorRef actorRef = getSystem().actorOf(props);
final MockActorContext actorContext = new MockActorContext(this.getSystem());
+ actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
actorContext.setExecuteRemoteOperationResponse("message");
TransactionProxy transactionProxy =
new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
ListenableFuture<Optional<NormalizedNode<?, ?>>> read =
Assert.assertFalse(normalizedNodeOptional.isPresent());
actorContext.setExecuteRemoteOperationResponse(new ReadDataReply(
- null));
+ TestModel.createTestContext(), null).toSerializable());
read = transactionProxy.read(TestModel.TEST_PATH);
final ActorRef actorRef = getSystem().actorOf(props);
final MockActorContext actorContext = new MockActorContext(this.getSystem());
+ actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
actorContext.setExecuteRemoteOperationResponse("message");
TransactionProxy transactionProxy =
new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
transactionProxy.write(TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.NAME_QNAME));
- ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
Object messages = testContext
.executeLocalOperation(actorRef, "messages",
ActorContext.ASK_DURATION);
Assert.assertEquals(1, listMessages.size());
- Assert.assertTrue(listMessages.get(0) instanceof WriteData);
+ Assert.assertEquals(WriteData.SERIALIZABLE_CLASS, listMessages.get(0).getClass());
+ }
+
+ private Object createPrimaryFound(ActorRef actorRef) {
+ return new PrimaryFound(actorRef.path().toString()).toSerializable();
}
@Test
final ActorRef actorRef = getSystem().actorOf(props);
final MockActorContext actorContext = new MockActorContext(this.getSystem());
+ actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
actorContext.setExecuteRemoteOperationResponse("message");
TransactionProxy transactionProxy =
new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
transactionProxy.merge(TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.NAME_QNAME));
- ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
Object messages = testContext
.executeLocalOperation(actorRef, "messages",
ActorContext.ASK_DURATION);
Assert.assertEquals(1, listMessages.size());
- Assert.assertTrue(listMessages.get(0) instanceof MergeData);
+ Assert.assertEquals(MergeData.SERIALIZABLE_CLASS, listMessages.get(0).getClass());
}
@Test
final ActorRef actorRef = getSystem().actorOf(props);
final MockActorContext actorContext = new MockActorContext(this.getSystem());
+ actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
actorContext.setExecuteRemoteOperationResponse("message");
TransactionProxy transactionProxy =
new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
transactionProxy.delete(TestModel.TEST_PATH);
- ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
Object messages = testContext
.executeLocalOperation(actorRef, "messages",
ActorContext.ASK_DURATION);
Assert.assertEquals(1, listMessages.size());
- Assert.assertTrue(listMessages.get(0) instanceof DeleteData);
+ Assert.assertEquals(DeleteData.SERIALIZABLE_CLASS, listMessages.get(0).getClass());
}
@Test
final ActorRef doNothingActorRef = getSystem().actorOf(props);
final MockActorContext actorContext = new MockActorContext(this.getSystem());
+ actorContext.setExecuteLocalOperationResponse(createPrimaryFound(doNothingActorRef));
actorContext.setExecuteShardOperationResponse(createTransactionReply(doNothingActorRef));
- actorContext.setExecuteRemoteOperationResponse(new ReadyTransactionReply(doNothingActorRef.path()));
+ actorContext.setExecuteRemoteOperationResponse(new ReadyTransactionReply(doNothingActorRef.path()).toSerializable());
TransactionProxy transactionProxy =
new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
+ transactionProxy.read(TestModel.TEST_PATH);
+
DOMStoreThreePhaseCommitCohort ready = transactionProxy.ready();
Assert.assertTrue(ready instanceof ThreePhaseCommitCohortProxy);
TransactionProxy transactionProxy =
new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
Assert.assertNotNull(transactionProxy.getIdentifier());
}
final ActorRef actorRef = getSystem().actorOf(props);
final MockActorContext actorContext = new MockActorContext(this.getSystem());
+ actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
actorContext.setExecuteRemoteOperationResponse("message");
TransactionProxy transactionProxy =
new TransactionProxy(actorContext,
- TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+ TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
+
+ transactionProxy.read(TestModel.TEST_PATH);
transactionProxy.close();
- ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
Object messages = testContext
.executeLocalOperation(actorRef, "messages",
ActorContext.ASK_DURATION);
Assert.assertEquals(1, listMessages.size());
- Assert.assertTrue(listMessages.get(0) instanceof CloseTransaction);
+ Assert.assertTrue(listMessages.get(0).getClass().equals(CloseTransaction.SERIALIZABLE_CLASS));
}
private CreateTransactionReply createTransactionReply(ActorRef actorRef){
- return new CreateTransactionReply(actorRef.path(), "txn-1");
+ return CreateTransactionReply.newBuilder()
+ .setTransactionActorPath(actorRef.path().toString())
+ .setTransactionId("txn-1")
+ .build();
}
}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.AbstractBaseMBean;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+public class ShardStatsTest {
+ private MBeanServer mbeanServer;
+ private ShardStats shardStats;
+ private ObjectName testMBeanName;
+
+ @Before
+ public void setUp() throws Exception {
+
+ shardStats = new ShardStats("shard-1");
+ shardStats.registerMBean();
+ mbeanServer= shardStats.getMBeanServer();
+ String objectName = AbstractBaseMBean.BASE_JMX_PREFIX + "type="+shardStats.getMBeanType()+",Category="+
+ shardStats.getMBeanCategory() + ",name="+
+ shardStats.getMBeanName();
+ testMBeanName = new ObjectName(objectName);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ shardStats.unregisterMBean();
+ }
+
+ @Test
+ public void testGetShardName() throws Exception {
+
+ Object attribute = mbeanServer.getAttribute(testMBeanName,"ShardName");
+ Assert.assertEquals((String) attribute, "shard-1");
+
+ }
+
+ @Test
+ public void testGetCommittedTransactionsCount() throws Exception {
+ //let us increment some transactions count and then check
+ shardStats.incrementCommittedTransactionCount();
+ shardStats.incrementCommittedTransactionCount();
+ shardStats.incrementCommittedTransactionCount();
+
+ //now let us get from MBeanServer what is the transaction count.
+ Object attribute = mbeanServer.getAttribute(testMBeanName,"CommittedTransactionsCount");
+ Assert.assertEquals((Long) attribute, (Long)3L);
+
+
+ }
+}
\ No newline at end of file
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+
+public class MergeDataTest {
+
+ @Test
+ public void testBasic(){
+ MergeData mergeData = new MergeData(TestModel.TEST_PATH, ImmutableNodes
+ .containerNode(TestModel.TEST_QNAME),
+ TestModel.createTestContext());
+
+ MergeData output = MergeData
+ .fromSerializable(mergeData.toSerializable(),
+ TestModel.createTestContext());
+
+ }
+
+ @Test
+ public void testNormalizedNodeEncodeDecode(){
+ NormalizedNode<?, ?> expected =
+ ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+
+
+ NormalizedNodeMessages.Container node =
+ new NormalizedNodeToNodeCodec(TestModel.createTestContext())
+ .encode(TestModel.TEST_PATH,
+ expected);
+
+ String parentPath = node.getParentPath();
+
+ NormalizedNodeMessages.Node normalizedNode =
+ node.getNormalizedNode();
+
+ NormalizedNode<?,?> actual = new NormalizedNodeToNodeCodec(TestModel.createTestContext()).decode(TestModel.TEST_PATH,
+ normalizedNode);
+
+
+ Assert.assertEquals(expected, actual);
+ }
+}
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public abstract class AbstractModificationTest {
cohort.commit();
}
- protected Optional<NormalizedNode<?,?>> readData(InstanceIdentifier path) throws Exception{
+ protected Optional<NormalizedNode<?,?>> readData(YangInstanceIdentifier path) throws Exception{
DOMStoreReadTransaction transaction = store.newReadOnlyTransaction();
ListenableFuture<Optional<NormalizedNode<?, ?>>> future = transaction.read(path);
return future.get();
public void testApply() throws Exception {
//Write something into the datastore
DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction();
- WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+ WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext());
writeModification.apply(writeTransaction);
commitTransaction(writeTransaction);
data = readData(TestModel.TEST_PATH);
Assert.assertFalse(data.isPresent());
}
-}
\ No newline at end of file
+}
//Write something into the datastore
DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction();
- MergeModification writeModification = new MergeModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+ MergeModification writeModification = new MergeModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext());
writeModification.apply(writeTransaction);
commitTransaction(writeTransaction);
Assert.assertTrue(data.isPresent());
}
-}
\ No newline at end of file
+}
public void testApply() throws Exception {
MutableCompositeModification compositeModification = new MutableCompositeModification();
- compositeModification.addModification(new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)));
+ compositeModification.addModification(new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()));
DOMStoreReadWriteTransaction transaction = store.newReadWriteTransaction();
compositeModification.apply(transaction);
Assert.assertNotNull(data.get());
Assert.assertEquals(TestModel.TEST_QNAME, data.get().getNodeType());
}
-}
\ No newline at end of file
+}
public void testApply() throws Exception {
//Write something into the datastore
DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction();
- WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+ WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext());
writeModification.apply(writeTransaction);
commitTransaction(writeTransaction);
Assert.assertTrue(data.isPresent());
}
-}
\ No newline at end of file
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.shardstrategy;
+
+import junit.framework.Assert;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.controller.cluster.datastore.ConfigurationImpl;
+import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
+
+public class ModuleShardStrategyTest {
+ @Rule
+ public ExpectedException expectedEx = ExpectedException.none();
+
+ private static Configuration configuration;
+
+ @BeforeClass
+ public static void setUpClass(){
+ configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+ }
+
+
+ @Test
+ public void testFindShard() throws Exception {
+ ModuleShardStrategy moduleShardStrategy =
+ new ModuleShardStrategy("cars", configuration);
+
+ String shard = moduleShardStrategy.findShard(CarsModel.BASE_PATH);
+
+ Assert.assertEquals("cars-1", shard);
+ }
+}
package org.opendaylight.controller.cluster.datastore.shardstrategy;
+import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.opendaylight.controller.cluster.datastore.ConfigurationImpl;
+import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
public class ShardStrategyFactoryTest {
- @Rule
- public ExpectedException expectedEx = ExpectedException.none();
+ @Rule
+ public ExpectedException expectedEx = ExpectedException.none();
- @Test
- public void testGetStrategy(){
- ShardStrategy strategy = ShardStrategyFactory.getStrategy(TestModel.TEST_PATH);
- assertNotNull(strategy);
- }
+ @BeforeClass
+ public static void setUpClass(){
+ ShardStrategyFactory.setConfiguration(new ConfigurationImpl("module-shards.conf", "modules.conf"));
+ }
- @Test
- public void testGetStrategyNullPointerExceptionWhenPathIsNull(){
- expectedEx.expect(NullPointerException.class);
- expectedEx.expectMessage("path should not be null");
+ @Test
+ public void testGetStrategy() {
+ ShardStrategy strategy =
+ ShardStrategyFactory.getStrategy(TestModel.TEST_PATH);
+ assertNotNull(strategy);
+ }
- ShardStrategyFactory.getStrategy(null);
- }
+ @Test
+ public void testGetStrategyForKnownModuleName() {
+ ShardStrategy strategy =
+ ShardStrategyFactory.getStrategy(
+ YangInstanceIdentifier.of(CarsModel.BASE_QNAME));
+ assertTrue(strategy instanceof ModuleShardStrategy);
+ }
-}
\ No newline at end of file
+
+ @Test
+ public void testGetStrategyNullPointerExceptionWhenPathIsNull() {
+ expectedEx.expect(NullPointerException.class);
+ expectedEx.expectMessage("path should not be null");
+
+ ShardStrategyFactory.getStrategy(null);
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.utils;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
+import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+
+public class ActorContextTest extends AbstractActorTest{
+ @Test
+ public void testResolvePathForRemoteActor(){
+ ActorContext actorContext =
+ new ActorContext(mock(ActorSystem.class), mock(ActorRef.class),mock(
+ ClusterWrapper.class),
+ mock(Configuration.class));
+
+ String actual = actorContext.resolvePath(
+ "akka.tcp://system@127.0.0.1:2550/user/shardmanager/shard",
+ "akka://system/user/shardmanager/shard/transaction");
+
+ String expected = "akka.tcp://system@127.0.0.1:2550/user/shardmanager/shard/transaction";
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testResolvePathForLocalActor(){
+ ActorContext actorContext =
+ new ActorContext(getSystem(), mock(ActorRef.class), mock(ClusterWrapper.class),
+ mock(Configuration.class));
+
+ String actual = actorContext.resolvePath(
+ "akka://system/user/shardmanager/shard",
+ "akka://system/user/shardmanager/shard/transaction");
+
+ String expected = "akka://system/user/shardmanager/shard/transaction";
+
+ assertEquals(expected, actual);
+
+ System.out.println(actorContext
+ .actorFor("akka://system/user/shardmanager/shard/transaction"));
+ }
+}
private Object executeLocalOperationResponse;
public MockActorContext(ActorSystem actorSystem) {
- super(actorSystem, null);
+ super(actorSystem, null, new MockClusterWrapper(), new MockConfiguration());
}
public MockActorContext(ActorSystem actorSystem, ActorRef shardManager) {
- super(actorSystem, shardManager);
+ super(actorSystem, shardManager, new MockClusterWrapper(), new MockConfiguration());
}
this.executeLocalOperationResponse = executeLocalOperationResponse;
}
-
+ @Override public Object executeLocalOperation(ActorRef actor,
+ Object message, FiniteDuration duration) {
+ return this.executeLocalOperationResponse;
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.utils;
+
+import akka.actor.ActorRef;
+import akka.actor.AddressFromURIString;
+import akka.cluster.ClusterEvent;
+import akka.cluster.MemberStatus;
+import akka.cluster.UniqueAddress;
+import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
+import scala.collection.JavaConversions;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class MockClusterWrapper implements ClusterWrapper{
+
+ @Override public void subscribeToMemberEvents(ActorRef actorRef) {
+ }
+
+ @Override public String getCurrentMemberName() {
+ return "member-1";
+ }
+
+ public static void sendMemberUp(ActorRef to, String memberName, String address){
+ to.tell(createMemberUp(memberName, address), null);
+ }
+
+ public static void sendMemberRemoved(ActorRef to, String memberName, String address){
+ to.tell(createMemberRemoved(memberName, address), null);
+ }
+
+ private static ClusterEvent.MemberRemoved createMemberRemoved(String memberName, String address) {
+ akka.cluster.UniqueAddress uniqueAddress = new UniqueAddress(
+ AddressFromURIString.parse(address), 55);
+
+ Set<String> roles = new HashSet<>();
+
+ roles.add(memberName);
+
+ akka.cluster.Member member = new akka.cluster.Member(uniqueAddress, 1, MemberStatus
+ .removed(),
+ JavaConversions.asScalaSet(roles).<String>toSet());
+
+ return new ClusterEvent.MemberRemoved(member, MemberStatus.up());
+
+ }
+
+
+ private static ClusterEvent.MemberUp createMemberUp(String memberName, String address) {
+ akka.cluster.UniqueAddress uniqueAddress = new UniqueAddress(
+ AddressFromURIString.parse(address), 55);
+
+ Set<String> roles = new HashSet<>();
+
+ roles.add(memberName);
+
+ akka.cluster.Member member = new akka.cluster.Member(uniqueAddress, 1, MemberStatus.up(),
+ JavaConversions.asScalaSet(roles).<String>toSet());
+
+ return new ClusterEvent.MemberUp(member);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.utils;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class MockConfiguration implements Configuration{
+ @Override public List<String> getMemberShardNames(String memberName) {
+ return Arrays.asList("default");
+ }
+
+ @Override public Optional<String> getModuleNameFromNameSpace(
+ String nameSpace) {
+ return Optional.absent();
+ }
+
+ @Override
+ public Map<String, ShardStrategy> getModuleNameToShardStrategyMap() {
+ return Collections.EMPTY_MAP;
+ }
+
+ @Override public List<String> getShardNamesFromModuleName(
+ String moduleName) {
+ return Collections.EMPTY_LIST;
+ }
+
+ @Override public List<String> getMembersFromShardName(String shardName) {
+ if("default".equals(shardName)) {
+ return Arrays.asList("member-1", "member-2");
+ } else if("astronauts".equals(shardName)){
+ return Arrays.asList("member-2", "member-3");
+ }
+
+ return Collections.EMPTY_LIST;
+ }
+}
public static void assertFirstSentMessage(ActorSystem actorSystem, ActorRef actorRef, Class clazz){
ActorContext testContext = new ActorContext(actorSystem, actorSystem.actorOf(
- Props.create(DoNothingActor.class)));
+ Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration());
Object messages = testContext
.executeLocalOperation(actorRef, "messages",
ActorContext.ASK_DURATION);
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.md.cluster.datastore.model;
+
+import java.math.BigInteger;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
+
+public class CarsModel {
+ public static final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars", "2014-03-13",
+ "cars");
+
+ public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME);
+
+ public static final QName CARS_QNAME = QName.create(BASE_QNAME, "cars");
+ public static final QName CAR_QNAME = QName.create(CARS_QNAME, "car");
+ public static final QName CAR_NAME_QNAME = QName.create(CAR_QNAME, "name");
+ public static final QName CAR_PRICE_QNAME = QName.create(CAR_QNAME, "price");
+
+
+ public static NormalizedNode create(){
+
+ // Create a list builder
+ CollectionNodeBuilder<MapEntryNode, MapNode> cars =
+ ImmutableMapNodeBuilder.create().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(
+ CAR_QNAME));
+
+ // Create an entry for the car altima
+ MapEntryNode altima =
+ ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "altima")
+ .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "altima"))
+ .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, new BigInteger("1000")))
+ .build();
+
+ // Create an entry for the car accord
+ MapEntryNode honda =
+ ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "accord")
+ .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "accord"))
+ .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, new BigInteger("2000")))
+ .build();
+
+ cars.withChild(altima);
+ cars.withChild(honda);
+
+ return ImmutableContainerNodeBuilder.create()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
+ .withChild(cars.build())
+ .build();
+
+ }
+
+ public static NormalizedNode emptyContainer(){
+ return ImmutableContainerNodeBuilder.create()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
+ .build();
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.md.cluster.datastore.model;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
+import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
+import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
+
+public class CompositeModel {
+
+ public static final QName TEST_QNAME = QName.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test",
+ "2014-03-13", "test");
+
+ public static final QName AUG_QNAME = QName.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
+ "2014-03-13", "name");
+
+ public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
+ public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME,
+ "outer-list");
+ public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME,
+ "inner-list");
+ public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME,
+ "outer-choice");
+ public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
+ public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
+ public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
+ private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
+ private static final String DATASTORE_AUG_YANG =
+ "/odl-datastore-augmentation.yang";
+ private static final String DATASTORE_TEST_NOTIFICATION_YANG =
+ "/odl-datastore-test-notification.yang";
+
+
+ public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier
+ .of(TEST_QNAME);
+ public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
+ .builder(TEST_PATH).node(DESC_QNAME).build();
+ public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier
+ .builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+ public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
+ public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
+
+ private static final Integer ONE_ID = 1;
+ private static final Integer TWO_ID = 2;
+ private static final String TWO_ONE_NAME = "one";
+ private static final String TWO_TWO_NAME = "two";
+ private static final String DESC = "Hello there";
+
+ // Family specific constants
+ public static final QName FAMILY_QNAME =
+ QName
+ .create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test",
+ "2014-04-17", "family");
+ public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+ "children");
+ public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+ "grand-children");
+ public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME,
+ "child-number");
+ public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
+ "child-name");
+ public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(
+ FAMILY_QNAME, "grand-child-number");
+ public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
+ "grand-child-name");
+
+ public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier
+ .of(FAMILY_QNAME);
+ public static final YangInstanceIdentifier FAMILY_DESC_PATH = YangInstanceIdentifier
+ .builder(FAMILY_PATH).node(DESC_QNAME).build();
+ public static final YangInstanceIdentifier CHILDREN_PATH = YangInstanceIdentifier
+ .builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
+
+ private static final Integer FIRST_CHILD_ID = 1;
+ private static final Integer SECOND_CHILD_ID = 2;
+
+ private static final String FIRST_CHILD_NAME = "first child";
+ private static final String SECOND_CHILD_NAME = "second child";
+
+ private static final Integer FIRST_GRAND_CHILD_ID = 1;
+ private static final Integer SECOND_GRAND_CHILD_ID = 2;
+
+ private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
+ private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
+
+ // first child
+ private static final YangInstanceIdentifier CHILDREN_1_PATH = YangInstanceIdentifier
+ .builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) //
+ .build();
+ private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier CHILDREN_2_PATH = YangInstanceIdentifier
+ .builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) //
+ .build();
+ private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) //
+ .build();
+
+
+ private static final YangInstanceIdentifier GRAND_CHILD_1_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_1_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_1_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+ FIRST_GRAND_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_2_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_2_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ SECOND_GRAND_CHILD_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_2_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+ SECOND_GRAND_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier DESC_PATH_ID = YangInstanceIdentifier
+ .builder(DESC_PATH).build();
+ private static final YangInstanceIdentifier OUTER_LIST_1_PATH =
+ YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+ .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier OUTER_LIST_2_PATH =
+ YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+ .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier
+ .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) //
+ .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH =
+ YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) //
+ .build();
+
+ private static final MapEntryNode BAR_NODE = mapEntryBuilder(
+ OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+ .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
+ .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
+ .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
+ .build()) //
+ .build();
+
+ public static final InputStream getDatastoreTestInputStream() {
+ return getInputStream(DATASTORE_TEST_YANG);
+ }
+
+ public static final InputStream getDatastoreAugInputStream() {
+ return getInputStream(DATASTORE_AUG_YANG);
+ }
+
+ public static final InputStream getDatastoreTestNotificationInputStream() {
+ return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
+ }
+
+ private static InputStream getInputStream(final String resourceName) {
+ return TestModel.class.getResourceAsStream(resourceName);
+ }
+
+ public static SchemaContext createTestContext() {
+ List<InputStream> inputStreams = new ArrayList<>();
+ inputStreams.add(getDatastoreTestInputStream());
+ inputStreams.add(getDatastoreAugInputStream());
+ inputStreams.add(getDatastoreTestNotificationInputStream());
+
+ YangParserImpl parser = new YangParserImpl();
+ Set<Module> modules = parser.parseYangModelsFromStreams(inputStreams);
+ return parser.resolveSchemaContext(modules);
+ }
+
+ /**
+ * Returns a test document
+ *
+ * <pre>
+ * test
+ * outer-list
+ * id 1
+ * outer-list
+ * id 2
+ * inner-list
+ * name "one"
+ * inner-list
+ * name "two"
+ *
+ * </pre>
+ *
+ * @return
+ */
+ public static NormalizedNode<?, ?> createDocumentOne(
+ SchemaContext schemaContext) {
+ return ImmutableContainerNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
+ .withChild(createTestContainer()).build();
+
+ }
+
+ public static ContainerNode createTestContainer() {
+
+
+ final LeafSetEntryNode<Object> nike =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+ "shoe"), "nike")).withValue("nike").build();
+ final LeafSetEntryNode<Object> puma =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+ "shoe"), "puma")).withValue("puma").build();
+ final LeafSetNode<Object> shoes =
+ ImmutableLeafSetNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME,
+ "shoe"))).withChild(nike).withChild(puma).build();
+
+
+ final LeafSetEntryNode<Object> five =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ (new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+ "number"), 5))).withValue(5).build();
+ final LeafSetEntryNode<Object> fifteen =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ (new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+ "number"), 15))).withValue(15).build();
+ final LeafSetNode<Object> numbers =
+ ImmutableLeafSetNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME,
+ "number"))).withChild(five).withChild(fifteen).build();
+
+
+ Set<QName> childAugmentations = new HashSet<>();
+ childAugmentations.add(AUG_QNAME);
+ final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
+ new YangInstanceIdentifier.AugmentationIdentifier(null, childAugmentations);
+ final AugmentationNode augmentationNode =
+ Builders.augmentationBuilder()
+ .withNodeIdentifier(augmentationIdentifier)
+ .withChild(ImmutableNodes.leafNode(AUG_QNAME, "First Test"))
+ .build();
+ return ImmutableContainerNodeBuilder
+ .create()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
+ .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
+ .withChild(augmentationNode)
+ .withChild(shoes)
+ .withChild(numbers)
+ .withChild(
+ mapNodeBuilder(OUTER_LIST_QNAME)
+ .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
+ .withChild(BAR_NODE).build()).build();
+
+ }
+
+
+ public static ContainerNode createFamily() {
+ final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> familyContainerBuilder =
+ ImmutableContainerNodeBuilder.create().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
+
+ final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
+ mapNodeBuilder(CHILDREN_QNAME);
+
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstChildBuilder =
+ mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondChildBuilder =
+ mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);
+
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstGrandChildBuilder =
+ mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID);
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondGrandChildBuilder =
+ mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ SECOND_GRAND_CHILD_ID);
+
+ firstGrandChildBuilder
+ .withChild(
+ ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID)).withChild(
+ ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+ FIRST_GRAND_CHILD_NAME));
+
+ secondGrandChildBuilder.withChild(
+ ImmutableNodes
+ .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
+ .withChild(
+ ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+ SECOND_GRAND_CHILD_NAME));
+
+ firstChildBuilder
+ .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
+ .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
+ .withChild(
+ mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+ firstGrandChildBuilder.build()).build());
+
+
+ secondChildBuilder
+ .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
+ .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
+ .withChild(
+ mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+ firstGrandChildBuilder.build()).build());
+
+ childrenBuilder.withChild(firstChildBuilder.build());
+ childrenBuilder.withChild(secondChildBuilder.build());
+
+ return familyContainerBuilder.withChild(childrenBuilder.build()).build();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.md.cluster.datastore.model;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
+
+public class PeopleModel {
+ public static final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people", "2014-03-13",
+ "people");
+
+ public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME);
+ public static final QName PEOPLE_QNAME = QName.create(BASE_QNAME, "people");
+ public static final QName PERSON_QNAME = QName.create(PEOPLE_QNAME, "person");
+ public static final QName PERSON_NAME_QNAME = QName.create(PERSON_QNAME, "name");
+ public static final QName PERSON_AGE_QNAME = QName.create(PERSON_QNAME, "age");
+
+
+
+ public static NormalizedNode create(){
+
+ // Create a list builder
+ CollectionNodeBuilder<MapEntryNode, MapNode> cars =
+ ImmutableMapNodeBuilder.create().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(
+ PERSON_QNAME));
+
+ // Create an entry for the person jack
+ MapEntryNode jack =
+ ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jack")
+ .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jack"))
+ .withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 100L))
+ .build();
+
+ // Create an entry for the person jill
+ MapEntryNode jill =
+ ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jill")
+ .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jill"))
+ .withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 200L))
+ .build();
+
+ cars.withChild(jack);
+ cars.withChild(jill);
+
+ return ImmutableContainerNodeBuilder.create()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
+ .withChild(cars.build())
+ .build();
+
+ }
+
+ public static NormalizedNode emptyContainer(){
+ return ImmutableContainerNodeBuilder.create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
+ .build();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.md.cluster.datastore.model;
+
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class SampleModelsTest {
+ @Test
+ public void testPeopleModel(){
+ final NormalizedNode<?, ?> expected = PeopleModel.create();
+
+
+ final NormalizedNodeMessages.Container node =
+ new NormalizedNodeToNodeCodec(SchemaContextHelper.full())
+ .encode(YangInstanceIdentifier.of(PeopleModel.BASE_QNAME),
+ expected);
+
+ final NormalizedNodeMessages.Node normalizedNode =
+ node.getNormalizedNode();
+
+ final NormalizedNode<?,?> actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(YangInstanceIdentifier.of(PeopleModel.BASE_QNAME),
+ normalizedNode);
+
+
+ Assert.assertEquals(expected, actual);
+
+ }
+
+
+ @Test
+ public void testCarsModel(){
+ final NormalizedNode<?, ?> expected = CarsModel.create();
+
+
+ final NormalizedNodeMessages.Container node =
+ new NormalizedNodeToNodeCodec(SchemaContextHelper.full())
+ .encode(YangInstanceIdentifier.of(CarsModel.BASE_QNAME),
+ expected);
+
+ final NormalizedNodeMessages.Node normalizedNode =
+ node.getNormalizedNode();
+
+ final NormalizedNode<?,?> actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(
+ YangInstanceIdentifier.of(CarsModel.BASE_QNAME),
+ normalizedNode);
+
+
+ Assert.assertEquals(expected, actual);
+
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.md.cluster.datastore.model;
+
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+public class SchemaContextHelper {
+
+ public static InputStream getInputStream(final String yangFileName) {
+ return TestModel.class.getResourceAsStream(yangFileName);
+ }
+
+ public static SchemaContext full(){
+ YangParserImpl parser = new YangParserImpl();
+ List<InputStream> streams = new ArrayList<>();
+ streams.add(getInputStream("/odl-datastore-test.yang"));
+ streams.add(getInputStream("/people.yang"));
+ streams.add(getInputStream("/cars.yang"));
+
+ Set<Module> modules = parser.parseYangModelsFromStreams(streams);
+ return parser.resolveSchemaContext(modules);
+
+ }
+}
package org.opendaylight.controller.md.cluster.datastore.model;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
- public static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
- public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+ public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
+ public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
public static final QName TWO_QNAME = QName.create(TEST_QNAME,"two");
public static final QName THREE_QNAME = QName.create(TEST_QNAME,"three");
akka {
actor {
- serializers {
- java = "akka.serialization.JavaSerializer"
- }
+ serializers {
+ java = "akka.serialization.JavaSerializer"
+ proto = "akka.remote.serialization.ProtobufSerializer"
+ }
serialization-bindings {
"org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification" = java
+ "com.google.protobuf.Message" = proto
+
}
}
-}
\ No newline at end of file
+}
--- /dev/null
+module cars {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars";
+ prefix "cars";
+
+ revision "2014-03-13" {
+ description "Initial revision.";
+ }
+
+ container cars {
+ list car {
+ key name;
+ leaf name {
+ type string;
+ }
+
+ leaf price {
+ type uint64;
+ }
+ }
+ }
+}
--- /dev/null
+module-shards = [
+ {
+ name = "default"
+ shards = [
+ {
+ name="default",
+ replicas = [
+ "member-1",
+ "member-2",
+ "member-3"
+ ]
+ }
+ ]
+ },
+ {
+ name = "people"
+ shards = [
+ {
+ name="people-1"
+ replicas = [
+ "member-1"
+ ]
+ }
+ ]
+ },
+ {
+ name = "cars"
+ shards = [
+ {
+ name="cars-1"
+ replicas = [
+ "member-1"
+ ]
+ }
+ ]
+ },
+ {
+ name = "test"
+ shards = [
+ {
+ name="test-1"
+ replicas = [
+ "member-1"
+ ]
+ }
+ ]
+ }
+
+]
--- /dev/null
+modules = [
+ {
+ name = "people"
+ namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people"
+ shard-strategy = "module"
+ },
+ {
+ name = "cars"
+ namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars"
+ shard-strategy = "module"
+ },
+ {
+ name = "test"
+ namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test"
+ shard-strategy = "module"
+ }
+
+]
--- /dev/null
+module odl-datastore-augmentation {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug";
+ prefix "store-aug";
+
+ import odl-datastore-test {prefix test;revision-date "2014-03-13";}
+
+ revision "2014-03-13" {
+ description "Initial revision.";
+ }
+
+
+ augment "/test:test" {
+ leaf name {
+ type string;
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+module odl-datastore-test-notification {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test";
+ prefix "notification-test-using-family-model";
+
+ revision "2014-04-17" {
+ description "Family structure created on ";
+ }
+
+ container family {
+ leaf desc {
+ type string;
+ }
+ list children {
+ key child-number;
+ leaf child-number {
+ type uint16;
+ }
+ leaf child-name {
+ type string;
+ }
+ list grand-children {
+ key grand-child-number;
+ leaf grand-child-number {
+ type uint16;
+ }
+ leaf grand-child-name {
+ type string;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+module people {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people";
+ prefix "people";
+
+ revision "2014-03-13" {
+ description "Initial revision.";
+ }
+
+ container people {
+ list person {
+ key name;
+ leaf name {
+ type string;
+ }
+
+ leaf age {
+ type uint32;
+ }
+ }
+ }
+}
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainFactory;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
*
*/
public interface DOMDataBroker extends
- AsyncDataBroker<InstanceIdentifier, NormalizedNode<?, ?>, DOMDataChangeListener>,
- TransactionChainFactory<InstanceIdentifier, NormalizedNode<?, ?>>, BrokerService, DOMService {
+ AsyncDataBroker<YangInstanceIdentifier, NormalizedNode<?, ?>, DOMDataChangeListener>,
+ TransactionChainFactory<YangInstanceIdentifier, NormalizedNode<?, ?>>, BrokerService, DOMService {
/**
* {@inheritDoc}
package org.opendaylight.controller.md.sal.dom.api;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public interface DOMDataChangeListener extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataChangeListener extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
}
package org.opendaylight.controller.md.sal.dom.api;
import org.opendaylight.controller.md.sal.common.api.data.AsyncReadOnlyTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public interface DOMDataReadOnlyTransaction extends DOMDataReadTransaction, AsyncReadOnlyTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataReadOnlyTransaction extends DOMDataReadTransaction, AsyncReadOnlyTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
}
import org.opendaylight.controller.md.sal.common.api.data.AsyncReadTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Optional;
* <p>
* For more information on usage and examples, please see the documentation in {@link AsyncReadTransaction}.
*/
-public interface DOMDataReadTransaction extends AsyncReadTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataReadTransaction extends AsyncReadTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
/**
* Reads data from provided logical data store located at the provided path.
* {@link ListenbleFuture#get()} returns {@link Optional#absent()}.
* </ul>
*/
- ListenableFuture<Optional<NormalizedNode<?,?>>> read(LogicalDatastoreType store,InstanceIdentifier path);
+ ListenableFuture<Optional<NormalizedNode<?,?>>> read(LogicalDatastoreType store,YangInstanceIdentifier path);
}
package org.opendaylight.controller.md.sal.dom.api;
import org.opendaylight.controller.md.sal.common.api.data.AsyncReadWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public interface DOMDataReadWriteTransaction extends DOMDataReadTransaction, DOMDataWriteTransaction, AsyncReadWriteTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataReadWriteTransaction extends DOMDataReadTransaction, DOMDataWriteTransaction, AsyncReadWriteTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
}
import org.opendaylight.controller.md.sal.common.api.data.AsyncWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* <p>
* For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
*/
-public interface DOMDataWriteTransaction extends AsyncWriteTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataWriteTransaction extends AsyncWriteTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
/**
* Stores a piece of data at the specified path. This acts as an add / replace
* @throws IllegalStateException
* if the transaction has already been submitted
*/
- void put(LogicalDatastoreType store, InstanceIdentifier path, NormalizedNode<?, ?> data);
+ void put(LogicalDatastoreType store, YangInstanceIdentifier path, NormalizedNode<?, ?> data);
/**
* Merges a piece of data with the existing data at a specified path. Any pre-existing data
* @throws IllegalStateException
* if the transaction has already been submitted
*/
- void merge(LogicalDatastoreType store, InstanceIdentifier path, NormalizedNode<?, ?> data);
+ void merge(LogicalDatastoreType store, YangInstanceIdentifier path, NormalizedNode<?, ?> data);
}
package org.opendaylight.controller.md.sal.dom.api;
import org.opendaylight.yangtools.concepts.Identifiable;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import com.google.common.base.Optional;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-public interface DOMMountPoint extends Identifiable<InstanceIdentifier> {
+public interface DOMMountPoint extends Identifiable<YangInstanceIdentifier> {
<T extends DOMService> Optional<T> getService(Class<T> cls);
import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import com.google.common.base.Optional;
public interface DOMMountPointService extends BrokerService {
- Optional<DOMMountPoint> getMountPoint(InstanceIdentifier path);
+ Optional<DOMMountPoint> getMountPoint(YangInstanceIdentifier path);
- DOMMountPointBuilder createMountPoint(InstanceIdentifier path);
+ DOMMountPointBuilder createMountPoint(YangInstanceIdentifier path);
ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener);
package org.opendaylight.controller.md.sal.dom.api;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* <p>
* This interface is type capture of {@link TransactionChain} for DOM Data Contracts.
*/
-public interface DOMTransactionChain extends TransactionChain<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMTransactionChain extends TransactionChain<YangInstanceIdentifier, NormalizedNode<?, ?>> {
@Override
DOMDataReadOnlyTransaction newReadOnlyTransaction();
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.osgi.framework.BundleContext;
/**
void close();
}
- public interface RoutedRpcRegistration extends RpcRegistration, RoutedRegistration<QName, InstanceIdentifier, RpcImplementation> {
+ public interface RoutedRpcRegistration extends RpcRegistration, RoutedRegistration<QName, YangInstanceIdentifier, RpcImplementation> {
}
}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import com.google.common.util.concurrent.ListenableFuture;
public interface RoutedRpcDefaultImplementation {
- ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, InstanceIdentifier identifier, CompositeNode input);
+ ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, YangInstanceIdentifier identifier, CompositeNode input);
}
import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-public interface RpcProvisionRegistry extends RpcImplementation, BrokerService, RouteChangePublisher<RpcRoutingContext, InstanceIdentifier>, DOMService {
+public interface RpcProvisionRegistry extends RpcImplementation, BrokerService, RouteChangePublisher<RpcRoutingContext, YangInstanceIdentifier>, DOMService {
/**
* Registers an implementation of the rpc.
import org.opendaylight.controller.md.sal.common.api.data.DataReader;
import org.opendaylight.controller.sal.core.api.BrokerService;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
@Deprecated
public interface DataBrokerService extends
BrokerService, //
- DataReader<InstanceIdentifier, CompositeNode>, //
- DataModificationTransactionFactory<InstanceIdentifier, CompositeNode>, //
- DataChangePublisher<InstanceIdentifier, CompositeNode, DataChangeListener> {
+ DataReader<YangInstanceIdentifier, CompositeNode>, //
+ DataModificationTransactionFactory<YangInstanceIdentifier, CompositeNode>, //
+ DataChangePublisher<YangInstanceIdentifier, CompositeNode, DataChangeListener> {
@Override
- public CompositeNode readConfigurationData(InstanceIdentifier path);
+ public CompositeNode readConfigurationData(YangInstanceIdentifier path);
@Override
- public CompositeNode readOperationalData(InstanceIdentifier path);
+ public CompositeNode readOperationalData(YangInstanceIdentifier path);
@Override
DataModificationTransaction beginTransaction();
import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
*
@Deprecated
public interface DataChangeListener
extends
- org.opendaylight.controller.md.sal.common.api.data.DataChangeListener<InstanceIdentifier, CompositeNode> {
+ org.opendaylight.controller.md.sal.common.api.data.DataChangeListener<YangInstanceIdentifier, CompositeNode> {
@Override
- public void onDataChanged(DataChangeEvent<InstanceIdentifier, CompositeNode> change);
+ public void onDataChanged(DataChangeEvent<YangInstanceIdentifier, CompositeNode> change);
}
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
*
*
*/
@Deprecated
-public interface DataModificationTransaction extends DataModification<InstanceIdentifier, CompositeNode> {
+public interface DataModificationTransaction extends DataModification<YangInstanceIdentifier, CompositeNode> {
/**
* Returns transaction identifier
import org.opendaylight.controller.sal.core.api.Provider;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
*
@Deprecated
public interface DataProviderService extends
DataBrokerService, //
- DataProvisionService<InstanceIdentifier, CompositeNode>
+ DataProvisionService<YangInstanceIdentifier, CompositeNode>
{
/**
void removeRefresher(DataStoreIdentifier store, DataRefresher refresher);
- Registration registerConfigurationReader(InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader);
+ Registration registerConfigurationReader(YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader);
- Registration registerOperationalReader(InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader);
+ Registration registerOperationalReader(YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader);
public interface DataRefresher extends Provider.ProviderFunctionality {
import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
import org.opendaylight.controller.md.sal.common.api.data.DataReader;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
*
*/
@Deprecated
public interface DataStore extends //
- DataReader<InstanceIdentifier, CompositeNode>,
- DataCommitHandler<InstanceIdentifier, CompositeNode> {
+ DataReader<YangInstanceIdentifier, CompositeNode>,
+ DataCommitHandler<YangInstanceIdentifier, CompositeNode> {
- Iterable<InstanceIdentifier> getStoredConfigurationPaths();
- Iterable<InstanceIdentifier> getStoredOperationalPaths();
+ Iterable<YangInstanceIdentifier> getStoredConfigurationPaths();
+ Iterable<YangInstanceIdentifier> getStoredOperationalPaths();
- boolean containsConfigurationPath(InstanceIdentifier path);
- boolean containsOperationalPath(InstanceIdentifier path);
+ boolean containsConfigurationPath(YangInstanceIdentifier path);
+ boolean containsOperationalPath(YangInstanceIdentifier path);
}
package org.opendaylight.controller.sal.core.api.mount;
import java.util.EventListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public interface MountProvisionListener extends EventListener {
- void onMountPointCreated(InstanceIdentifier path);
+ void onMountPointCreated(YangInstanceIdentifier path);
- void onMountPointRemoved(InstanceIdentifier path);
+ void onMountPointRemoved(YangInstanceIdentifier path);
}
package org.opendaylight.controller.sal.core.api.mount;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
* @deprecated Use org.opendaylight.controller.md.sal.dom.api.DOMMountPointService instead
public interface MountProvisionService extends MountService {
@Override
- public MountProvisionInstance getMountPoint(InstanceIdentifier path);
+ public MountProvisionInstance getMountPoint(YangInstanceIdentifier path);
- MountProvisionInstance createMountPoint(InstanceIdentifier path);
+ MountProvisionInstance createMountPoint(YangInstanceIdentifier path);
- MountProvisionInstance createOrGetMountPoint(InstanceIdentifier path);
+ MountProvisionInstance createOrGetMountPoint(YangInstanceIdentifier path);
ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener);
package org.opendaylight.controller.sal.core.api.mount;
import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
* Client-level interface for interacting with mount points. It provides access
* @param path Path at which the instance is registered
* @return Reference to the instance, or null if no such instance exists.
*/
- MountInstance getMountPoint(InstanceIdentifier path);
+ MountInstance getMountPoint(YangInstanceIdentifier path);
}
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>mockito-configuration</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<instructions>
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
<Bundle-Activator>org.opendaylight.controller.sal.dom.broker.osgi.SchemaServiceActivator</Bundle-Activator>
- <Export-Package>org.opendaylight.controller.sal.dom.broker.spi</Export-Package>
- <Private-Package>org.opendaylight.controller.sal.dom.broker,
+ <Export-Package>org.opendaylight.controller.sal.dom.broker.spi,
+ <!--sal.broker.impl is exported for sal-netconf-connector to use SchemaAwareRpcRegistry.-->
+ <!-- TODO Remove sal.broker.impl from export when SchemaAwareRpcRegistry is not used in connector anymore -->
org.opendaylight.controller.sal.dom.broker.impl,
org.opendaylight.controller.sal.dom.broker.impl.*,
+ </Export-Package>
+ <Private-Package>org.opendaylight.controller.sal.dom.broker,
org.opendaylight.controller.sal.dom.broker.osgi,
org.opendaylight.controller.sal.dom.broker.util,
org.opendaylight.controller.config.yang.md.sal.dom.impl,
- org.opendaylight.controller.config.yang.md.sal.dom.statistics,
+ org.opendaylight.controller.config.yang.md.sal.dom.statistics,\
org.opendaylight.controller.md.sal.dom.broker.impl,
org.opendaylight.controller.md.sal.dom.broker.impl.*,
org.opendaylight.yangtools.yang.util,
*/
package org.opendaylight.controller.config.yang.md.sal.dom.impl;
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.MutableClassToInstanceMap;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleDataBroker;
+import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
import org.opendaylight.controller.sal.core.api.BrokerService;
import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
import org.opendaylight.controller.sal.core.api.mount.MountService;
+import org.opendaylight.controller.sal.dom.broker.BackwardsCompatibleMountPointManager;
import org.opendaylight.controller.sal.dom.broker.BrokerImpl;
import org.opendaylight.controller.sal.dom.broker.DataBrokerImpl;
import org.opendaylight.controller.sal.dom.broker.GlobalBundleScanningSchemaServiceImpl;
-import org.opendaylight.controller.sal.dom.broker.MountPointManagerImpl;
import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter;
import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker;
import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProviders;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-
-import com.google.common.collect.ClassToInstanceMap;
-import com.google.common.collect.MutableClassToInstanceMap;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
*
services.putInstance(DataProviderService.class,legacyData);
services.putInstance(DataBrokerService.class, legacyData);
+ final DOMMountPointService mountService = new DOMMountPointServiceImpl();
+ services.putInstance(DOMMountPointService.class, mountService);
- MountPointManagerImpl mountService = new MountPointManagerImpl();
- services.putInstance(MountService.class, mountService);
- services.putInstance(MountProvisionService.class, mountService);
+ // TODO remove backwards service, use only new DOMMountPointService
+ final MountProvisionService backwardsMountService = new BackwardsCompatibleMountPointManager(mountService);
+ services.putInstance(MountService.class, backwardsMountService);
+ services.putInstance(MountProvisionService.class, backwardsMountService);
return new BrokerImpl(router, services);
}
private DataProviderService createLegacyDataService(final DataStore legacyStore, final SchemaService schemaService) {
- InstanceIdentifier rootPath = InstanceIdentifier.builder().toInstance();
+ YangInstanceIdentifier rootPath = YangInstanceIdentifier.builder().toInstance();
DataBrokerImpl dataService = new DataBrokerImpl();
SchemaAwareDataStoreAdapter wrappedStore = new SchemaAwareDataStoreAdapter();
wrappedStore.changeDelegate(legacyStore);
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Preconditions;
* Subtransaction type
*/
abstract class AbstractDOMForwardedCompositeTransaction<K, T extends DOMStoreTransaction> implements
- AsyncTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+ AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
private final ImmutableMap<K, T> backingTxs;
private final Object identifier;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Override
public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
- final InstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+ final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
DOMStore potentialStore = getTxFactories().get(store);
checkState(potentialStore != null, "Requested logical data store is not available.");
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Optional;
* Read Only Transaction, which is composed of several
* {@link DOMStoreReadTransaction} transactions. Subtransaction is selected by
* {@link LogicalDatastoreType} type parameter in
- * {@link #read(LogicalDatastoreType, InstanceIdentifier)}.
+ * {@link #read(LogicalDatastoreType, YangInstanceIdentifier)}.
*/
class DOMForwardedReadOnlyTransaction extends
AbstractDOMForwardedCompositeTransaction<LogicalDatastoreType, DOMStoreReadTransaction> implements
@Override
public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
- final InstanceIdentifier path) {
+ final YangInstanceIdentifier path) {
return getSubtransaction(store).read(path);
}
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Optional;
* {@link LogicalDatastoreType} type parameter in:
*
* <ul>
- * <li>{@link #read(LogicalDatastoreType, InstanceIdentifier)}
- * <li>{@link #put(LogicalDatastoreType, InstanceIdentifier, NormalizedNode)}
- * <li>{@link #delete(LogicalDatastoreType, InstanceIdentifier)}
- * <li>{@link #merge(LogicalDatastoreType, InstanceIdentifier, NormalizedNode)}
+ * <li>{@link #read(LogicalDatastoreType, YangInstanceIdentifier)}
+ * <li>{@link #put(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
+ * <li>{@link #delete(LogicalDatastoreType, YangInstanceIdentifier)}
+ * <li>{@link #merge(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
* </ul>
* {@link #commit()} will result in invocation of
* {@link DOMDataCommitImplementation#submit(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction, Iterable)}
@Override
public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
- final InstanceIdentifier path) {
+ final YangInstanceIdentifier path) {
return getSubtransaction(store).read(path);
}
}
\ No newline at end of file
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Preconditions;
* {@link LogicalDatastoreType} type parameter in:
*
* <ul>
- * <li>{@link #put(LogicalDatastoreType, InstanceIdentifier, NormalizedNode)}
- * <li>{@link #delete(LogicalDatastoreType, InstanceIdentifier)}
- * <li>{@link #merge(LogicalDatastoreType, InstanceIdentifier, NormalizedNode)}
+ * <li>{@link #put(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
+ * <li>{@link #delete(LogicalDatastoreType, YangInstanceIdentifier)}
+ * <li>{@link #merge(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
* </ul>
* <p>
* {@link #commit()} will result in invocation of
}
@Override
- public void put(final LogicalDatastoreType store, final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
checkNotReady();
getSubtransaction(store).write(path, data);
}
@Override
- public void delete(final LogicalDatastoreType store, final InstanceIdentifier path) {
+ public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
checkNotReady();
getSubtransaction(store).delete(path);
}
@Override
- public void merge(final LogicalDatastoreType store, final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
checkNotReady();
getSubtransaction(store).merge(path, data);
}
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
}
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier legacyPath) {
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier legacyPath) {
final BackwardsCompatibleTransaction<?> tx = BackwardsCompatibleTransaction.readOnlyTransaction(backingBroker.newReadOnlyTransaction(),normalizer);
try {
return tx.readConfigurationData(legacyPath);
}
@Override
- public CompositeNode readOperationalData(final InstanceIdentifier legacyPath) {
+ public CompositeNode readOperationalData(final YangInstanceIdentifier legacyPath) {
final BackwardsCompatibleTransaction<?> tx = BackwardsCompatibleTransaction.readOnlyTransaction(backingBroker.newReadOnlyTransaction(),normalizer);
try {
return tx.readOperationalData(legacyPath);
}
@Override
- public ListenerRegistration<DataChangeListener> registerDataChangeListener(final InstanceIdentifier legacyPath,
+ public ListenerRegistration<DataChangeListener> registerDataChangeListener(final YangInstanceIdentifier legacyPath,
final DataChangeListener listener) {
- final InstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
+ final YangInstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
final TranslatingListenerInvoker translatingCfgListener =
TranslatingListenerInvoker.createConfig(listener, normalizer);
@Override
public Registration registerCommitHandler(
- final InstanceIdentifier path, final DataCommitHandler<InstanceIdentifier, CompositeNode> commitHandler) {
+ final YangInstanceIdentifier path, final DataCommitHandler<YangInstanceIdentifier, CompositeNode> commitHandler) {
// FIXME Do real forwarding
- return new AbstractObjectRegistration<DataCommitHandler<InstanceIdentifier,CompositeNode>>(commitHandler) {
+ return new AbstractObjectRegistration<DataCommitHandler<YangInstanceIdentifier,CompositeNode>>(commitHandler) {
@Override
protected void removeRegistration() {
// NOOP
}
@Override
- public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
- final RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>> commitHandlerListener) {
+ public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
+ final RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>> commitHandlerListener) {
return null;
}
@Override
public Registration registerConfigurationReader(
- final InstanceIdentifier path, final DataReader<InstanceIdentifier, CompositeNode> reader) {
+ final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
throw new UnsupportedOperationException("Data Reader contract is not supported.");
}
@Override
public Registration registerOperationalReader(
- final InstanceIdentifier path, final DataReader<InstanceIdentifier, CompositeNode> reader) {
+ final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
throw new UnsupportedOperationException("Data Reader contract is not supported.");
}
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
};
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier legacyPath) {
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier legacyPath) {
- InstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
+ YangInstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
ListenableFuture<Optional<NormalizedNode<?, ?>>> normalizedData = asyncTx.read(
LogicalDatastoreType.CONFIGURATION, normalizedPath);
}
@Override
- public CompositeNode readOperationalData(final InstanceIdentifier legacyPath) {
- InstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
+ public CompositeNode readOperationalData(final YangInstanceIdentifier legacyPath) {
+ YangInstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
ListenableFuture<Optional<NormalizedNode<?, ?>>> normalizedData = asyncTx.read(
LogicalDatastoreType.OPERATIONAL, normalizedPath);
}
@Override
- public Map<InstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
+ public Map<YangInstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
return Collections.emptyMap();
}
@Override
- public Map<InstanceIdentifier, CompositeNode> getCreatedOperationalData() {
+ public Map<YangInstanceIdentifier, CompositeNode> getCreatedOperationalData() {
return Collections.emptyMap();
}
@Override
- public Map<InstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
+ public Map<YangInstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
return Collections.emptyMap();
}
@Override
- public Map<InstanceIdentifier, CompositeNode> getOriginalOperationalData() {
+ public Map<YangInstanceIdentifier, CompositeNode> getOriginalOperationalData() {
return Collections.emptyMap();
}
@Override
- public Set<InstanceIdentifier> getRemovedConfigurationData() {
+ public Set<YangInstanceIdentifier> getRemovedConfigurationData() {
return Collections.emptySet();
}
@Override
- public Set<InstanceIdentifier> getRemovedOperationalData() {
+ public Set<YangInstanceIdentifier> getRemovedOperationalData() {
return Collections.emptySet();
}
@Override
- public Map<InstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
+ public Map<YangInstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
return Collections.emptyMap();
}
@Override
- public Map<InstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
+ public Map<YangInstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
return Collections.emptyMap();
}
@Override
- public void putConfigurationData(final InstanceIdentifier path, final CompositeNode data) {
+ public void putConfigurationData(final YangInstanceIdentifier path, final CompositeNode data) {
throw new UnsupportedOperationException();
}
@Override
- public void putOperationalData(final InstanceIdentifier path, final CompositeNode data) {
+ public void putOperationalData(final YangInstanceIdentifier path, final CompositeNode data) {
throw new UnsupportedOperationException();
}
@Override
- public void removeConfigurationData(final InstanceIdentifier path) {
+ public void removeConfigurationData(final YangInstanceIdentifier path) {
throw new UnsupportedOperationException();
}
@Override
- public void removeOperationalData(final InstanceIdentifier path) {
+ public void removeOperationalData(final YangInstanceIdentifier path) {
throw new UnsupportedOperationException();
}
}
@Override
- public void putConfigurationData(final InstanceIdentifier legacyPath, final CompositeNode legacyData) {
+ public void putConfigurationData(final YangInstanceIdentifier legacyPath, final CompositeNode legacyData) {
checkNotNull(legacyPath, "Path MUST NOT be null.");
checkNotNull(legacyData, "Data for path %s MUST NOT be null",legacyData);
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedData = getNormalizer().toNormalized(legacyPath, legacyData);
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedData = getNormalizer().toNormalized(legacyPath, legacyData);
putWithEnsuredParents(LogicalDatastoreType.CONFIGURATION, normalizedData.getKey(), normalizedData.getValue());
}
@Override
- public void putOperationalData(final InstanceIdentifier legacyPath, final CompositeNode legacyData) {
+ public void putOperationalData(final YangInstanceIdentifier legacyPath, final CompositeNode legacyData) {
checkNotNull(legacyPath, "Path MUST NOT be null.");
checkNotNull(legacyData, "Data for path %s MUST NOT be null",legacyData);
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedData = getNormalizer().toNormalized(legacyPath, legacyData);
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedData = getNormalizer().toNormalized(legacyPath, legacyData);
putWithEnsuredParents(LogicalDatastoreType.OPERATIONAL, normalizedData.getKey(), normalizedData.getValue());
}
- private void putWithEnsuredParents(final LogicalDatastoreType store, final InstanceIdentifier normalizedPath,
+ private void putWithEnsuredParents(final LogicalDatastoreType store, final YangInstanceIdentifier normalizedPath,
final NormalizedNode<?, ?> normalizedData) {
LOG.trace("write {}:{} ",store,normalizedPath);
throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", normalizedPath), e);
}
currentArguments.add(currentArg);
- InstanceIdentifier currentPath = InstanceIdentifier.create(currentArguments);
+ YangInstanceIdentifier currentPath = YangInstanceIdentifier.create(currentArguments);
boolean isPresent = getDelegate().read(store, currentPath).get().isPresent();
if(isPresent == false && iterator.hasNext()) {
getDelegate().merge(store, currentPath, currentOp.createDefault(currentArg));
}
@Override
- public void removeConfigurationData(final InstanceIdentifier legacyPath) {
+ public void removeConfigurationData(final YangInstanceIdentifier legacyPath) {
checkNotNull(legacyPath, "Path MUST NOT be null.");
getDelegate().delete(LogicalDatastoreType.CONFIGURATION, getNormalizer().toNormalized(legacyPath));
}
@Override
- public void removeOperationalData(final InstanceIdentifier legacyPath) {
+ public void removeOperationalData(final YangInstanceIdentifier legacyPath) {
checkNotNull(legacyPath, "Path MUST NOT be null.");
getDelegate().delete(LogicalDatastoreType.OPERATIONAL, getNormalizer().toNormalized(legacyPath));
}
import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.collect.Maps;
public abstract class TranslatingDataChangeEvent implements
-DataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> {
+DataChangeEvent<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> {
private TranslatingDataChangeEvent() {
}
- public static DataChangeEvent<InstanceIdentifier, CompositeNode> createOperational(
- final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change, final DataNormalizer normalizer) {
+ public static DataChangeEvent<YangInstanceIdentifier, CompositeNode> createOperational(
+ final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change, final DataNormalizer normalizer) {
return new OperationalChangeEvent(change, normalizer);
}
- public static DataChangeEvent<InstanceIdentifier, CompositeNode> createConfiguration(
- final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change, final DataNormalizer normalizer) {
+ public static DataChangeEvent<YangInstanceIdentifier, CompositeNode> createConfiguration(
+ final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change, final DataNormalizer normalizer) {
return new ConfigurationChangeEvent(change, normalizer);
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getCreatedOperationalData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getCreatedOperationalData() {
return Collections.emptyMap();
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
return Collections.emptyMap();
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
return Collections.emptyMap();
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
return Collections.emptyMap();
}
@Override
- public Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getRemovedConfigurationData() {
+ public Set<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getRemovedConfigurationData() {
return Collections.emptySet();
}
@Override
- public Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getRemovedOperationalData() {
+ public Set<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getRemovedOperationalData() {
return Collections.emptySet();
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
return Collections.emptyMap();
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getOriginalOperationalData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getOriginalOperationalData() {
return Collections.emptyMap();
}
private final static class OperationalChangeEvent extends TranslatingDataChangeEvent {
- private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> delegate;
+ private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> delegate;
private final DataNormalizer normalizer;
- private Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> updatedCache;
+ private Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> updatedCache;
- public OperationalChangeEvent(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change,
+ public OperationalChangeEvent(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change,
final DataNormalizer normalizer) {
this.delegate = change;
this.normalizer = normalizer;
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getCreatedOperationalData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getCreatedOperationalData() {
return transformToLegacy(normalizer, delegate.getCreatedData());
}
@Override
- public Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getRemovedOperationalData() {
+ public Set<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getRemovedOperationalData() {
return delegate.getRemovedPaths();
}
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getOriginalOperationalData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getOriginalOperationalData() {
return transformToLegacy(normalizer, delegate.getOriginalData());
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
if(updatedCache == null) {
- final Map<InstanceIdentifier, CompositeNode> updated = transformToLegacy(normalizer, delegate.getUpdatedData());
- final Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> created = getCreatedConfigurationData();
- final HashMap<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> updatedComposite = new HashMap<>(created.size() + updated.size());
+ final Map<YangInstanceIdentifier, CompositeNode> updated = transformToLegacy(normalizer, delegate.getUpdatedData());
+ final Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> created = getCreatedConfigurationData();
+ final HashMap<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> updatedComposite = new HashMap<>(created.size() + updated.size());
updatedComposite.putAll(created);
updatedComposite.putAll(updated);
updatedCache = Collections.unmodifiableMap(updatedComposite);
}
- private static Map<InstanceIdentifier, CompositeNode> transformToLegacy(final DataNormalizer normalizer, final Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> nodes) {
- final Map<InstanceIdentifier, CompositeNode> legacy = Maps.newHashMap();
+ private static Map<YangInstanceIdentifier, CompositeNode> transformToLegacy(final DataNormalizer normalizer, final Map<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> nodes) {
+ final Map<YangInstanceIdentifier, CompositeNode> legacy = Maps.newHashMap();
- for (final Map.Entry<InstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : nodes.entrySet()) {
+ for (final Map.Entry<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : nodes.entrySet()) {
try {
legacy.put(normalizer.toLegacy(entry.getKey()), normalizer.toLegacy(entry.getKey(), entry.getValue()));
} catch (final DataNormalizationException e) {
private final static class ConfigurationChangeEvent extends TranslatingDataChangeEvent {
- private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> delegate;
+ private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> delegate;
private final DataNormalizer normalizer;
- private Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> updatedCache;
+ private Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> updatedCache;
- public ConfigurationChangeEvent(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change,
+ public ConfigurationChangeEvent(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change,
final DataNormalizer normalizer) {
this.delegate = change;
this.normalizer = normalizer;
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
return transformToLegacy(normalizer, delegate.getCreatedData());
}
@Override
- public Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getRemovedConfigurationData() {
+ public Set<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getRemovedConfigurationData() {
return delegate.getRemovedPaths();
}
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
return transformToLegacy(normalizer, delegate.getOriginalData());
}
@Override
- public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
+ public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
if(updatedCache == null) {
- final Map<InstanceIdentifier, CompositeNode> updated = transformToLegacy(normalizer, delegate.getUpdatedData());
- final Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> created = getCreatedConfigurationData();
- final HashMap<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> updatedComposite = new HashMap<>(created.size() + updated.size());
+ final Map<YangInstanceIdentifier, CompositeNode> updated = transformToLegacy(normalizer, delegate.getUpdatedData());
+ final Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> created = getCreatedConfigurationData();
+ final HashMap<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> updatedComposite = new HashMap<>(created.size() + updated.size());
updatedComposite.putAll(created);
updatedComposite.putAll(updated);
updatedCache = Collections.unmodifiableMap(updatedComposite);
import org.opendaylight.yangtools.concepts.Delegator;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
abstract class TranslatingListenerInvoker implements AutoCloseable, DOMDataChangeListener, Delegator<DataChangeListener> {
}
@Override
- public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
+ public void onDataChanged(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
delegate.onDataChanged(getLegacyEvent(normalizer, normalizedChange));
}
- abstract DataChangeEvent<InstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer,
- final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> normalizedChange);
+ abstract DataChangeEvent<YangInstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer,
+ final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedChange);
@Override
public DataChangeListener getDelegate() {
return delegate;
}
- abstract void register(final DOMDataBroker backingBroker, final InstanceIdentifier normalizedPath);
+ abstract void register(final DOMDataBroker backingBroker, final YangInstanceIdentifier normalizedPath);
@Override
public void close() {
super(listener, normalizer);
}
- DataChangeEvent<InstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer, final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
+ DataChangeEvent<YangInstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer, final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
return TranslatingDataChangeEvent.createConfiguration(normalizedChange, normalizer);
}
@Override
- void register(final DOMDataBroker backingBroker, final InstanceIdentifier normalizedPath) {
+ void register(final DOMDataBroker backingBroker, final YangInstanceIdentifier normalizedPath) {
reg = backingBroker.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, normalizedPath, this,
AsyncDataBroker.DataChangeScope.SUBTREE);
}
super(listener, normalizer);
}
- DataChangeEvent<InstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer, final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
+ DataChangeEvent<YangInstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer, final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
return TranslatingDataChangeEvent.createOperational(normalizedChange, normalizer);
}
@Override
- void register(final DOMDataBroker backingBroker, final InstanceIdentifier normalizedPath) {
+ void register(final DOMDataBroker backingBroker, final YangInstanceIdentifier normalizedPath) {
reg = backingBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, normalizedPath, this,
AsyncDataBroker.DataChangeScope.SUBTREE);
}
package org.opendaylight.controller.md.sal.dom.broker.impl.mount;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.MutableClassToInstanceMap;
import java.util.HashMap;
import java.util.Map;
-
import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.md.sal.dom.api.DOMService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ClassToInstanceMap;
-import com.google.common.collect.MutableClassToInstanceMap;
-
public class DOMMountPointServiceImpl implements DOMMountPointService {
- private final Map<InstanceIdentifier, SimpleDOMMountPoint> mountPoints = new HashMap<>();
+ private final Map<YangInstanceIdentifier, DOMMountPoint> mountPoints = new HashMap<>();
private final ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create();
@Override
- public Optional<DOMMountPoint> getMountPoint(final InstanceIdentifier path) {
- return Optional.<DOMMountPoint>fromNullable(mountPoints.get(path));
+ public Optional<DOMMountPoint> getMountPoint(final YangInstanceIdentifier path) {
+ return Optional.fromNullable(mountPoints.get(path));
}
@Override
- public DOMMountPointBuilder createMountPoint(final InstanceIdentifier path) {
+ public DOMMountPointBuilder createMountPoint(final YangInstanceIdentifier path) {
Preconditions.checkState(!mountPoints.containsKey(path), "Mount point already exists");
return new DOMMountPointBuilderImpl(path);
}
- public void notifyMountCreated(final InstanceIdentifier identifier) {
+ public void notifyMountCreated(final YangInstanceIdentifier identifier) {
for (final ListenerRegistration<MountProvisionListener> listener : listeners
.getListeners()) {
listener.getInstance().onMountPointCreated(identifier);
}
}
+ public void notifyMountRemoved(final YangInstanceIdentifier identifier) {
+ for (final ListenerRegistration<MountProvisionListener> listener : listeners
+ .getListeners()) {
+ listener.getInstance().onMountPointRemoved(identifier);
+ }
+ }
+
@Override
public ListenerRegistration<MountProvisionListener> registerProvisionListener(
final MountProvisionListener listener) {
return listeners.register(listener);
}
- public ObjectRegistration<DOMMountPoint> registerMountPoint(final SimpleDOMMountPoint mountPoint) {
+ public ObjectRegistration<DOMMountPoint> registerMountPoint(final DOMMountPoint mountPoint) {
synchronized (mountPoints) {
Preconditions.checkState(!mountPoints.containsKey(mountPoint.getIdentifier()), "Mount point already exists");
mountPoints.put(mountPoint.getIdentifier(), mountPoint);
}
notifyMountCreated(mountPoint.getIdentifier());
- // FIXME this shouldnt be null
- return null;
+ return new MountRegistration(mountPoint);
+ }
+
+ public void unregisterMountPoint(final YangInstanceIdentifier mountPointId) {
+ synchronized (mountPoints) {
+ Preconditions.checkState(mountPoints.containsKey(mountPointId), "Mount point does not exist");
+ mountPoints.remove(mountPointId);
+ }
+ notifyMountRemoved(mountPointId);
}
public class DOMMountPointBuilderImpl implements DOMMountPointBuilder {
ClassToInstanceMap<DOMService> services = MutableClassToInstanceMap.create();
private SimpleDOMMountPoint mountPoint;
- private final InstanceIdentifier path;
+ private final YangInstanceIdentifier path;
private SchemaContext schemaContext;
- public DOMMountPointBuilderImpl(final InstanceIdentifier path) {
+ public DOMMountPointBuilderImpl(final YangInstanceIdentifier path) {
this.path = path;
}
return registerMountPoint(mountPoint);
}
}
+
+ private final class MountRegistration implements ObjectRegistration<DOMMountPoint> {
+ private final DOMMountPoint mountPoint;
+
+ public MountRegistration(final DOMMountPoint mountPoint) {
+ this.mountPoint = mountPoint;
+ }
+
+ @Override
+ public DOMMountPoint getInstance() {
+ return mountPoint;
+ }
+
+ @Override
+ public void close() throws Exception {
+ unregisterMountPoint(mountPoint.getIdentifier());
+ }
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+package org.opendaylight.controller.sal.dom.broker;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.annotation.Nullable;
+import org.opendaylight.controller.md.sal.common.api.RegistrationListener;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandlerRegistration;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.md.sal.common.impl.ListenerRegistry;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.md.sal.dom.api.DOMService;
+import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleDataBroker;
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
+import org.opendaylight.controller.sal.core.api.RoutedRpcDefaultImplementation;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
+import org.opendaylight.controller.sal.core.api.RpcRoutingContext;
+import org.opendaylight.controller.sal.core.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.core.api.data.DataProviderService;
+import org.opendaylight.controller.sal.core.api.data.DataValidator;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
+import org.opendaylight.controller.sal.dom.broker.impl.NotificationRouterImpl;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
+import org.opendaylight.controller.sal.dom.broker.spi.NotificationRouter;
+import org.opendaylight.controller.sal.dom.broker.util.ProxySchemaContext;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
+
+public class BackwardsCompatibleMountPoint implements MountProvisionInstance, SchemaContextProvider, SchemaService {
+
+ private final DataProviderService dataReader;
+ private final DataReader<YangInstanceIdentifier,CompositeNode> readWrapper;
+
+ private final YangInstanceIdentifier mountPath;
+ private final NotificationPublishService notificationPublishService;
+ private final RpcProvisionRegistry rpcs;
+
+ private final ListenerRegistry<SchemaServiceListener> schemaListenerRegistry = new ListenerRegistry<>();
+
+ private SchemaContext schemaContext;
+
+ public BackwardsCompatibleMountPoint(final YangInstanceIdentifier path, final DOMMountPointService.DOMMountPointBuilder mountPointBuilder) {
+ this.mountPath = Preconditions.checkNotNull(path);
+ Preconditions.checkNotNull(mountPointBuilder);
+
+ dataReader = new DataBrokerImpl();
+ readWrapper = new ReadWrapper();
+ notificationPublishService = new DelgatingNotificationPublishService();
+ rpcs = new SchemaAwareRpcBroker(path.toString(), this);
+
+ mountPointBuilder.addService(DOMDataBroker.class, new BackwardsCompatibleDomStore(dataReader, this));
+ mountPointBuilder.addService(NotificationPublishService.class, notificationPublishService);
+ mountPointBuilder.addService(RpcProvisionRegistry.class, rpcs);
+
+ mountPointBuilder.addInitialSchemaContext(new ProxySchemaContext(this));
+
+ mountPointBuilder.register();
+ }
+
+ public BackwardsCompatibleMountPoint(final YangInstanceIdentifier path, final DOMMountPoint mount) {
+ this.mountPath = Preconditions.checkNotNull(path);
+ Preconditions.checkNotNull(mount);
+
+ final DOMDataBroker domBroker = getServiceWithCheck(mount, DOMDataBroker.class);
+
+ this.schemaContext = mount.getSchemaContext();
+
+ dataReader = new BackwardsCompatibleDataBroker(domBroker, this);
+
+ // Set schema context to provide it for BackwardsCompatibleDataBroker
+ if(schemaContext != null) {
+ setSchemaContext(schemaContext);
+ }
+
+ readWrapper = new ReadWrapper();
+
+ notificationPublishService = getServiceWithCheck(mount, NotificationPublishService.class);
+ rpcs = getServiceWithCheck(mount, RpcProvisionRegistry.class);
+ }
+
+ private <T extends DOMService> T getServiceWithCheck(final DOMMountPoint mount, final Class<T> type) {
+ final Optional<T> serviceOptional = mount.getService(type);
+ Preconditions.checkArgument(serviceOptional.isPresent(), "Service {} has to be set in {}. " +
+ "Cannot construct backwards compatible mount wrapper without it", type, mount);
+ return serviceOptional.get();
+ }
+
+ @Override
+ public void addModule(final Module module) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeModule(final Module module) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public SchemaContext getSessionContext() {
+ return getSchemaContext();
+ }
+
+ @Override
+ public SchemaContext getGlobalContext() {
+ return getSchemaContext();
+ }
+
+ @Override
+ public ListenerRegistration<SchemaServiceListener> registerSchemaServiceListener(final SchemaServiceListener listener) {
+ return schemaListenerRegistry.register(listener);
+ }
+
+ @Override
+ public void publish(final CompositeNode notification) {
+ notificationPublishService.publish(notification);
+ }
+
+ @Override
+ public ListenerRegistration<NotificationListener> addNotificationListener(final QName notification, final NotificationListener listener) {
+ return notificationPublishService.addNotificationListener(notification, listener);
+ }
+
+ // TODO Read wrapper is never used ... same in org.opendaylight.controller.sal.dom.broker.MountPointImpl
+ public DataReader<YangInstanceIdentifier, CompositeNode> getReadWrapper() {
+ return readWrapper;
+ }
+
+ @Override
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
+ return dataReader.readConfigurationData(path);
+ }
+
+ @Override
+ public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
+ return dataReader.readOperationalData(path);
+ }
+
+ @Override
+ public Registration registerOperationalReader(
+ final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
+ return dataReader.registerOperationalReader(path, reader);
+ }
+
+ @Override
+ public Registration registerConfigurationReader(
+ final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
+ return dataReader.registerConfigurationReader(path, reader);
+ }
+
+ @Override
+ public RoutedRpcRegistration addRoutedRpcImplementation(final QName rpcType, final RpcImplementation implementation) {
+ return rpcs.addRoutedRpcImplementation(rpcType, implementation);
+ }
+
+ @Override
+ public void setRoutedRpcDefaultDelegate(final RoutedRpcDefaultImplementation defaultImplementation) {
+ rpcs.setRoutedRpcDefaultDelegate(defaultImplementation);
+ }
+
+ @Override
+ public RpcRegistration addRpcImplementation(final QName rpcType, final RpcImplementation implementation)
+ throws IllegalArgumentException {
+ return rpcs.addRpcImplementation(rpcType, implementation);
+ }
+
+ @Override
+ public Set<QName> getSupportedRpcs() {
+ return rpcs.getSupportedRpcs();
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(final QName rpc, final CompositeNode input) {
+ return rpcs.invokeRpc(rpc, input);
+ }
+
+ @Override
+ public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(final RpcRegistrationListener listener) {
+ return rpcs.addRpcRegistrationListener(listener);
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<CompositeNode>> rpc(final QName type, final CompositeNode input) {
+ return rpcs.invokeRpc(type, input);
+ }
+
+ @Override
+ public DataModificationTransaction beginTransaction() {
+ return dataReader.beginTransaction();
+ }
+
+ @Override
+ public ListenerRegistration<DataChangeListener> registerDataChangeListener(final YangInstanceIdentifier path,
+ final DataChangeListener listener) {
+ return dataReader.registerDataChangeListener(path, listener);
+ }
+
+ @Override
+ public Registration registerCommitHandler(
+ final YangInstanceIdentifier path, final DataCommitHandler<YangInstanceIdentifier, CompositeNode> commitHandler) {
+ return dataReader.registerCommitHandler(path, commitHandler);
+ }
+
+ @Override
+ public void removeRefresher(final DataStoreIdentifier store, final DataRefresher refresher) {
+ // NOOP
+ }
+
+ @Override
+ public void addRefresher(final DataStoreIdentifier store, final DataRefresher refresher) {
+ // NOOP
+ }
+
+ @Override
+ public void addValidator(final DataStoreIdentifier store, final DataValidator validator) {
+ // NOOP
+ }
+ @Override
+ public void removeValidator(final DataStoreIdentifier store, final DataValidator validator) {
+ // NOOP
+ }
+
+ @Override
+ public SchemaContext getSchemaContext() {
+ return schemaContext;
+ }
+
+ @Override
+ public void setSchemaContext(final SchemaContext schemaContext) {
+ this.schemaContext = schemaContext;
+ for (ListenerRegistration<SchemaServiceListener> schemaServiceListenerListenerRegistration : schemaListenerRegistry.getListeners()) {
+ schemaServiceListenerListenerRegistration.getInstance().onGlobalContextUpdated(schemaContext);
+ }
+ }
+
+ class ReadWrapper implements DataReader<YangInstanceIdentifier, CompositeNode> {
+ private YangInstanceIdentifier shortenPath(final YangInstanceIdentifier path) {
+ YangInstanceIdentifier ret = null;
+ if(mountPath.contains(path)) {
+ final List<PathArgument> newArgs = path.getPath().subList(mountPath.getPath().size(), path.getPath().size());
+ ret = YangInstanceIdentifier.create(newArgs);
+ }
+ return ret;
+ }
+
+ @Override
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
+ final YangInstanceIdentifier newPath = shortenPath(path);
+ if(newPath == null) {
+ return null;
+ }
+ return BackwardsCompatibleMountPoint.this.readConfigurationData(newPath);
+ }
+
+ @Override
+ public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
+ final YangInstanceIdentifier newPath = shortenPath(path);
+ if(newPath == null) {
+ return null;
+ }
+ return BackwardsCompatibleMountPoint.this.readOperationalData(newPath);
+ }
+ }
+
+ @Override
+ public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
+ final RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>> commitHandlerListener) {
+ return dataReader.registerCommitHandlerListener(commitHandlerListener);
+ }
+
+ @Override
+ public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+ final L listener) {
+ return rpcs.registerRouteChangeListener(listener);
+ }
+
+ @VisibleForTesting
+ static final class BackwardsCompatibleDomStore implements DOMDataBroker {
+ private final DataProviderService dataReader;
+ private final SchemaContextProvider schemaContextProvider;
+
+ public BackwardsCompatibleDomStore(final DataProviderService dataReader, final SchemaContextProvider schemaContextProvider) {
+ this.dataReader = dataReader;
+ this.schemaContextProvider = schemaContextProvider;
+ }
+
+ @Override
+ public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
+ final DataNormalizer dataNormalizer = new DataNormalizer(schemaContextProvider.getSchemaContext());
+ return new BackwardsCompatibleReadTransaction(dataReader, dataNormalizer);
+ }
+
+ @Override
+ public DOMDataWriteTransaction newWriteOnlyTransaction() {
+ final DataNormalizer dataNormalizer = new DataNormalizer(schemaContextProvider.getSchemaContext());
+ return new BackwardsCompatibleWriteTransaction(dataReader, dataNormalizer);
+ }
+
+ @Override
+ public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store, final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+ throw new UnsupportedOperationException("Register data listener not supported for mount point");
+ }
+
+ @Override
+ public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
+ throw new UnsupportedOperationException("Transaction chain not supported for mount point");
+ }
+
+ @Override
+ public DOMDataReadWriteTransaction newReadWriteTransaction() {
+ final DataNormalizer dataNormalizer = new DataNormalizer(schemaContextProvider.getSchemaContext());
+ return new BackwardsCompatibleReadWriteTransaction(dataReader, dataNormalizer);
+ }
+
+ @VisibleForTesting
+ static final class BackwardsCompatibleReadTransaction implements DOMDataReadOnlyTransaction {
+ private final DataProviderService dataReader;
+ private final DataNormalizer normalizer;
+
+ public BackwardsCompatibleReadTransaction(final DataProviderService dataReader, final DataNormalizer normalizer) {
+ this.dataReader = dataReader;
+ this.normalizer = normalizer;
+ }
+
+ @Override
+ public Object getIdentifier() {
+ return this;
+ }
+
+ @Override
+ public void close() {
+ // NOOP
+ }
+
+ @Override
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+
+ CompositeNode rawData = null;
+
+ switch (store) {
+ case CONFIGURATION: {
+ rawData = dataReader.readConfigurationData(path);
+ break;
+ }
+ case OPERATIONAL: {
+ rawData = dataReader.readOperationalData(path);
+ break;
+ }
+ }
+ Preconditions.checkNotNull(rawData, "Unable to read %s data on path %s", store, path);
+
+ final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalized = normalizer.toNormalized(path, rawData);
+ final Optional<NormalizedNode<?, ?>> normalizedNodeOptional = Optional.<NormalizedNode<?, ?>>fromNullable(normalized.getValue());
+ return com.google.common.util.concurrent.Futures.immediateFuture(normalizedNodeOptional);
+ }
+ }
+
+ @VisibleForTesting
+ static final class BackwardsCompatibleWriteTransaction implements DOMDataWriteTransaction {
+ private DataModificationTransaction oldTx;
+ private final DataNormalizer dataNormalizer;
+
+ public BackwardsCompatibleWriteTransaction(final DataProviderService dataReader, final DataNormalizer dataNormalizer) {
+ this.oldTx = dataReader.beginTransaction();
+ this.dataNormalizer = dataNormalizer;
+ }
+
+ @Override
+ public Object getIdentifier() {
+ return this;
+ }
+
+ @Override
+ public boolean cancel() {
+ oldTx = null;
+ return true;
+ }
+
+ @Override
+ public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ final CompositeNode legacyData = dataNormalizer.toLegacy(path, data);
+ try {
+ final YangInstanceIdentifier legacyPath = dataNormalizer.toLegacy(path);
+
+ switch (store) {
+ case CONFIGURATION: {
+ oldTx.putConfigurationData(legacyPath, legacyData);
+ return;
+ }
+ }
+
+ throw new IllegalArgumentException("Cannot put data " + path + " to datastore " + store);
+ } catch (final DataNormalizationException e) {
+ throw new IllegalArgumentException(String.format("Cannot transform path %s to legacy format", path), e);
+ }
+ }
+
+ @Override
+ public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ // TODO not supported
+ throw new UnsupportedOperationException("Merge not supported for mount point");
+ }
+
+ @Override
+ public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ try {
+ final YangInstanceIdentifier legacyPath = dataNormalizer.toLegacy(path);
+
+ switch (store) {
+ case CONFIGURATION: {
+ oldTx.removeConfigurationData(legacyPath);
+ return;
+ }
+ }
+ throw new IllegalArgumentException("Cannot delete data " + path + " from datastore " + store);
+ } catch (final DataNormalizationException e) {
+ throw new IllegalArgumentException(String.format("Cannot transform path %s to legacy format", path), e);
+ }
+ }
+
+ @Override
+ public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+ final ListenableFuture<Void> commitAsVoid = Futures.transform(commit(), new Function<RpcResult<TransactionStatus>, Void>() {
+ @Override
+ public Void apply(@Nullable final RpcResult<TransactionStatus> input) {
+ return null;
+ }
+ });
+
+ return Futures.makeChecked(commitAsVoid, new Function<Exception, TransactionCommitFailedException>() {
+ @Override
+ public TransactionCommitFailedException apply(@Nullable final Exception input) {
+ return new TransactionCommitFailedException("Commit failed", input);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+ return JdkFutureAdapters.listenInPoolThread(oldTx.commit());
+ }
+ }
+
+
+ @VisibleForTesting
+ static class BackwardsCompatibleReadWriteTransaction implements DOMDataReadWriteTransaction {
+
+ private final DataProviderService dataReader;
+ private final DataNormalizer dataNormalizer;
+ private final BackwardsCompatibleWriteTransaction delegateWriteTx;
+
+ public BackwardsCompatibleReadWriteTransaction(final DataProviderService dataReader, final DataNormalizer dataNormalizer) {
+ this.dataReader = dataReader;
+ this.dataNormalizer = dataNormalizer;
+ this.delegateWriteTx = new BackwardsCompatibleWriteTransaction(dataReader, dataNormalizer);
+ }
+
+ @Override
+ public Object getIdentifier() {
+ return this;
+ }
+
+ @Override
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ return new BackwardsCompatibleReadTransaction(dataReader, dataNormalizer).read(store, path);
+ }
+
+ @Override
+ public boolean cancel() {
+ return delegateWriteTx.cancel();
+ }
+
+ @Override
+ public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ delegateWriteTx.put(store, path, data);
+ }
+
+ @Override
+ public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ delegateWriteTx.merge(store, path, data);
+ }
+
+ @Override
+ public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ delegateWriteTx.delete(store, path);
+ }
+
+ @Override
+ public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+ return delegateWriteTx.submit();
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+ return delegateWriteTx.commit();
+ }
+ }
+ }
+
+ private class DelgatingNotificationPublishService implements NotificationPublishService {
+ private final NotificationRouter notificationRouter;
+
+ public DelgatingNotificationPublishService(final NotificationRouter notificationRouter) {
+ this.notificationRouter = notificationRouter;
+ }
+
+ private DelgatingNotificationPublishService() {
+ this(new NotificationRouterImpl());
+ }
+
+ @Override
+ public void publish(final CompositeNode notification) {
+ notificationRouter.publish(notification);
+ }
+
+ @Override
+ public ListenerRegistration<NotificationListener> addNotificationListener(final QName notification, final NotificationListener listener) {
+ return notificationRouter.addNotificationListener(notification, listener);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+package org.opendaylight.controller.sal.dom.broker;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import com.google.common.base.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class BackwardsCompatibleMountPointManager implements MountProvisionService, MountProvisionListener {
+
+ private final ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create();
+ private final ConcurrentMap<YangInstanceIdentifier, MountProvisionInstance> mounts = new ConcurrentHashMap<>();
+
+ private final DOMMountPointService domMountPointService;
+
+ public BackwardsCompatibleMountPointManager(final DOMMountPointService domMountPointService) {
+ this.domMountPointService = domMountPointService;
+ }
+
+ @Override
+ public MountProvisionInstance createMountPoint(final YangInstanceIdentifier path) {
+ checkState(!mounts.containsKey(path), "Mount already created");
+ // Create mount point instance, wrap instance of new API with BackwardsCompatibleMountPoint to preserve backwards comatibility
+ final BackwardsCompatibleMountPoint mount = new BackwardsCompatibleMountPoint(path, domMountPointService.createMountPoint(path));
+ mounts.put(path, mount);
+ return mount;
+ }
+
+ public void notifyMountCreated(final YangInstanceIdentifier identifier) {
+ for (final ListenerRegistration<MountProvisionListener> listener : listeners.getListeners()) {
+ listener.getInstance().onMountPointCreated(identifier);
+ }
+ }
+
+ public void notifyMountRemoved(final YangInstanceIdentifier identifier) {
+ for (final ListenerRegistration<MountProvisionListener> listener : listeners.getListeners()) {
+ listener.getInstance().onMountPointRemoved(identifier);
+ }
+ }
+
+ @Override
+ public MountProvisionInstance createOrGetMountPoint(
+ final YangInstanceIdentifier path) {
+ final MountProvisionInstance mount = getMountPoint(path);
+ if (mount == null) {
+ return createMountPoint(path);
+ }
+ return mount;
+ }
+
+ @Override
+ public MountProvisionInstance getMountPoint(final YangInstanceIdentifier path) {
+ // If the mount point was created here, return directly
+ if(mounts.containsKey(path)) {
+ return mounts.get(path);
+ }
+
+ // If mount was created in underlying DOMMountService, wrap as MountProvisionInstance
+ final Optional<DOMMountPoint> mount = domMountPointService.getMountPoint(path);
+ if(mount.isPresent()) {
+ return new BackwardsCompatibleMountPoint(path, mount.get());
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public ListenerRegistration<MountProvisionListener> registerProvisionListener(
+ final MountProvisionListener listener) {
+ return domMountPointService.registerProvisionListener(listener);
+ }
+
+ @Override
+ public void onMountPointCreated(final YangInstanceIdentifier path) {
+ notifyMountCreated(path);
+ }
+
+ @Override
+ public void onMountPointRemoved(final YangInstanceIdentifier path) {
+ notifyMountRemoved(path);
+ }
+}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
@Override
- public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+ public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
final L listener) {
return router.registerRouteChangeListener(listener);
}
import org.opendaylight.controller.sal.dom.broker.impl.DataReaderRouter;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import com.google.common.util.concurrent.MoreExecutors;
-public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier, CompositeNode, DataChangeListener> implements
+public class DataBrokerImpl extends AbstractDataBroker<YangInstanceIdentifier, CompositeNode, DataChangeListener> implements
DataProviderService, AutoCloseable {
private AtomicLong nextTransaction = new AtomicLong();
@Override
public Registration registerConfigurationReader(
- InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
+ YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader) {
return getDataReadRouter().registerConfigurationReader(path, reader);
}
@Override
public Registration registerOperationalReader(
- InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
+ YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader) {
return getDataReadRouter().registerOperationalReader(path, reader);
}
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-public class DataTransactionImpl extends AbstractDataTransaction<InstanceIdentifier, CompositeNode>
+public class DataTransactionImpl extends AbstractDataTransaction<YangInstanceIdentifier, CompositeNode>
implements DataModificationTransaction {
private final ListenerRegistry<DataTransactionListener> listeners = new ListenerRegistry<DataTransactionListener>();
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import com.google.common.util.concurrent.ListenableFuture;
private final SchemaAwareRpcBroker rpcs;
private final DataBrokerImpl dataReader;
private final NotificationRouter notificationRouter;
- private final DataReader<InstanceIdentifier,CompositeNode> readWrapper;
+ private final DataReader<YangInstanceIdentifier,CompositeNode> readWrapper;
- private final InstanceIdentifier mountPath;
+ private final YangInstanceIdentifier mountPath;
private SchemaContext schemaContext;
- public MountPointImpl(final InstanceIdentifier path) {
+ public MountPointImpl(final YangInstanceIdentifier path) {
this.mountPath = path;
rpcs = new SchemaAwareRpcBroker(path.toString(),this);
dataReader = new DataBrokerImpl();
readWrapper = new ReadWrapper();
}
- public InstanceIdentifier getMountPath() {
+ public YangInstanceIdentifier getMountPath() {
return mountPath;
}
- public DataReader<InstanceIdentifier, CompositeNode> getReadWrapper() {
+ public DataReader<YangInstanceIdentifier, CompositeNode> getReadWrapper() {
return readWrapper;
}
}
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
return dataReader.readConfigurationData(path);
}
@Override
- public CompositeNode readOperationalData(final InstanceIdentifier path) {
+ public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
return dataReader.readOperationalData(path);
}
@Override
public Registration registerOperationalReader(
- final InstanceIdentifier path, final DataReader<InstanceIdentifier, CompositeNode> reader) {
+ final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
return dataReader.registerOperationalReader(path, reader);
}
@Override
public Registration registerConfigurationReader(
- final InstanceIdentifier path, final DataReader<InstanceIdentifier, CompositeNode> reader) {
+ final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
return dataReader.registerConfigurationReader(path, reader);
}
}
@Override
- public ListenerRegistration<DataChangeListener> registerDataChangeListener(final InstanceIdentifier path,
+ public ListenerRegistration<DataChangeListener> registerDataChangeListener(final YangInstanceIdentifier path,
final DataChangeListener listener) {
return dataReader.registerDataChangeListener(path, listener);
}
@Override
public Registration registerCommitHandler(
- final InstanceIdentifier path, final DataCommitHandler<InstanceIdentifier, CompositeNode> commitHandler) {
+ final YangInstanceIdentifier path, final DataCommitHandler<YangInstanceIdentifier, CompositeNode> commitHandler) {
return dataReader.registerCommitHandler(path, commitHandler);
}
this.schemaContext = schemaContext;
}
- class ReadWrapper implements DataReader<InstanceIdentifier, CompositeNode> {
- private InstanceIdentifier shortenPath(final InstanceIdentifier path) {
- InstanceIdentifier ret = null;
+ class ReadWrapper implements DataReader<YangInstanceIdentifier, CompositeNode> {
+ private YangInstanceIdentifier shortenPath(final YangInstanceIdentifier path) {
+ YangInstanceIdentifier ret = null;
if(mountPath.contains(path)) {
List<PathArgument> newArgs = path.getPath().subList(mountPath.getPath().size(), path.getPath().size());
- ret = InstanceIdentifier.create(newArgs);
+ ret = YangInstanceIdentifier.create(newArgs);
}
return ret;
}
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier path) {
- InstanceIdentifier newPath = shortenPath(path);
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
+ YangInstanceIdentifier newPath = shortenPath(path);
if(newPath == null) {
return null;
}
}
@Override
- public CompositeNode readOperationalData(final InstanceIdentifier path) {
- InstanceIdentifier newPath = shortenPath(path);
+ public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
+ YangInstanceIdentifier newPath = shortenPath(path);
if(newPath == null) {
return null;
}
}
@Override
- public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
- final RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>> commitHandlerListener) {
+ public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
+ final RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>> commitHandlerListener) {
return dataReader.registerCommitHandlerListener(commitHandlerListener);
}
@Override
- public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+ public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
final L listener) {
return rpcs.registerRouteChangeListener(listener);
}
import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@Deprecated
public class MountPointManagerImpl implements MountProvisionService {
private final ListenerRegistry<MountProvisionListener> listeners =
ListenerRegistry.create();
- private final ConcurrentMap<InstanceIdentifier, MountPointImpl> mounts =
+ private final ConcurrentMap<YangInstanceIdentifier, MountPointImpl> mounts =
new ConcurrentHashMap<>();
private DataProviderService dataBroker = null;
@Override
- public MountProvisionInstance createMountPoint(final InstanceIdentifier path) {
+ public MountProvisionInstance createMountPoint(final YangInstanceIdentifier path) {
checkState(!mounts.containsKey(path), "Mount already created");
final MountPointImpl mount = new MountPointImpl(path);
registerMountPoint(mount);
return mount;
}
- public void notifyMountCreated(final InstanceIdentifier identifier) {
+ public void notifyMountCreated(final YangInstanceIdentifier identifier) {
for (final ListenerRegistration<MountProvisionListener> listener : listeners
.getListeners()) {
listener.getInstance().onMountPointCreated(identifier);
@Override
public MountProvisionInstance createOrGetMountPoint(
- final InstanceIdentifier path) {
+ final YangInstanceIdentifier path) {
final MountPointImpl mount = mounts.get(path);
if (mount == null) {
return createMountPoint(path);
}
@Override
- public MountProvisionInstance getMountPoint(final InstanceIdentifier path) {
+ public MountProvisionInstance getMountPoint(final YangInstanceIdentifier path) {
return mounts.get(path);
}
import org.opendaylight.controller.md.sal.common.impl.routing.AbstractDataReadRouter;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
import org.slf4j.LoggerFactory;
public class DataReaderRouter extends
-AbstractDataReadRouter<InstanceIdentifier, CompositeNode> {
+AbstractDataReadRouter<YangInstanceIdentifier, CompositeNode> {
private final static Logger LOG = LoggerFactory
.getLogger(DataReaderRouter.class);
private final static URI NETCONF_NAMESPACE = URI
"data");
@Override
- protected CompositeNodeTOImpl merge(final InstanceIdentifier path,
+ protected CompositeNodeTOImpl merge(final YangInstanceIdentifier path,
final Iterable<CompositeNode> data) {
PathArgument pathArgument = Iterables.getLast(path.getPathArguments(), null);
boolean empty = true;
}
public Map<QName, SimpleNode<?>> getKeyNodes(
- final InstanceIdentifier.PathArgument argument,
+ final YangInstanceIdentifier.PathArgument argument,
final CompositeNode node) {
- if (argument instanceof InstanceIdentifier.NodeIdentifierWithPredicates) {
+ if (argument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
return _getKeyNodes(
- (InstanceIdentifier.NodeIdentifierWithPredicates) argument,
+ (YangInstanceIdentifier.NodeIdentifierWithPredicates) argument,
node);
} else if (argument != null) {
return _getKeyNodes(argument, node);
import org.opendaylight.controller.sal.core.api.data.DataStore;
import org.opendaylight.yangtools.concepts.Delegator;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class DataStoreStatsWrapper implements Delegator<DataStore>, DataStore {
}
@Override
- public CompositeNode readConfigurationData(InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(YangInstanceIdentifier path) {
cfgReadCount.incrementAndGet();
final long startTime = System.nanoTime();
try {
}
@Override
- public CompositeNode readOperationalData(InstanceIdentifier path) {
+ public CompositeNode readOperationalData(YangInstanceIdentifier path) {
operReadCount.incrementAndGet();
final long startTime = System.nanoTime();
try {
}
}
- public DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
- DataModification<InstanceIdentifier, CompositeNode> modification) {
+ public DataCommitTransaction<YangInstanceIdentifier, CompositeNode> requestCommit(
+ DataModification<YangInstanceIdentifier, CompositeNode> modification) {
requestCommitCount.incrementAndGet();
final long startTime = System.nanoTime();
try {
};
@Override
- public boolean containsConfigurationPath(InstanceIdentifier path) {
+ public boolean containsConfigurationPath(YangInstanceIdentifier path) {
return delegate.containsConfigurationPath(path);
}
- public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
+ public Iterable<YangInstanceIdentifier> getStoredConfigurationPaths() {
return delegate.getStoredConfigurationPaths();
}
- public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
+ public Iterable<YangInstanceIdentifier> getStoredOperationalPaths() {
return delegate.getStoredOperationalPaths();
}
- public boolean containsOperationalPath(InstanceIdentifier path) {
+ public boolean containsOperationalPath(YangInstanceIdentifier path) {
return delegate.containsOperationalPath(path);
}
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory
.getLogger(HashMapDataStore.class);
- private final Map<InstanceIdentifier, CompositeNode> configuration = new ConcurrentHashMap<InstanceIdentifier, CompositeNode>();
- private final Map<InstanceIdentifier, CompositeNode> operational = new ConcurrentHashMap<InstanceIdentifier, CompositeNode>();
+ private final Map<YangInstanceIdentifier, CompositeNode> configuration = new ConcurrentHashMap<YangInstanceIdentifier, CompositeNode>();
+ private final Map<YangInstanceIdentifier, CompositeNode> operational = new ConcurrentHashMap<YangInstanceIdentifier, CompositeNode>();
@Override
- public boolean containsConfigurationPath(final InstanceIdentifier path) {
+ public boolean containsConfigurationPath(final YangInstanceIdentifier path) {
return configuration.containsKey(path);
}
@Override
- public boolean containsOperationalPath(final InstanceIdentifier path) {
+ public boolean containsOperationalPath(final YangInstanceIdentifier path) {
return operational.containsKey(path);
}
@Override
- public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
+ public Iterable<YangInstanceIdentifier> getStoredConfigurationPaths() {
return configuration.keySet();
}
@Override
- public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
+ public Iterable<YangInstanceIdentifier> getStoredOperationalPaths() {
return operational.keySet();
}
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
LOG.trace("Reading configuration path {}", path);
return configuration.get(path);
}
@Override
- public CompositeNode readOperationalData(InstanceIdentifier path) {
+ public CompositeNode readOperationalData(YangInstanceIdentifier path) {
LOG.trace("Reading operational path {}", path);
return operational.get(path);
}
@Override
- public DataCommitHandler.DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
- final DataModification<InstanceIdentifier, CompositeNode> modification) {
+ public DataCommitHandler.DataCommitTransaction<YangInstanceIdentifier, CompositeNode> requestCommit(
+ final DataModification<YangInstanceIdentifier, CompositeNode> modification) {
return new HashMapDataStoreTransaction(modification, this);
}
}
public RpcResult<Void> finish(HashMapDataStoreTransaction transaction) {
- final DataModification<InstanceIdentifier, CompositeNode> modification = transaction
+ final DataModification<YangInstanceIdentifier, CompositeNode> modification = transaction
.getModification();
- for (final InstanceIdentifier removal : modification
+ for (final YangInstanceIdentifier removal : modification
.getRemovedConfigurationData()) {
LOG.trace("Removing configuration path {}", removal);
remove(configuration, removal);
}
- for (final InstanceIdentifier removal : modification
+ for (final YangInstanceIdentifier removal : modification
.getRemovedOperationalData()) {
LOG.trace("Removing operational path {}", removal);
remove(operational, removal);
}
if (LOG.isTraceEnabled()) {
- for (final InstanceIdentifier a : modification
+ for (final YangInstanceIdentifier a : modification
.getUpdatedConfigurationData().keySet()) {
LOG.trace("Adding configuration path {}", a);
}
- for (final InstanceIdentifier a : modification
+ for (final YangInstanceIdentifier a : modification
.getUpdatedOperationalData().keySet()) {
LOG.trace("Adding operational path {}", a);
}
return RpcResultBuilder.<Void> success().build();
}
- public void remove(final Map<InstanceIdentifier, CompositeNode> map,
- final InstanceIdentifier identifier) {
- Set<InstanceIdentifier> affected = new HashSet<InstanceIdentifier>();
- for (final InstanceIdentifier path : map.keySet()) {
+ public void remove(final Map<YangInstanceIdentifier, CompositeNode> map,
+ final YangInstanceIdentifier identifier) {
+ Set<YangInstanceIdentifier> affected = new HashSet<YangInstanceIdentifier>();
+ for (final YangInstanceIdentifier path : map.keySet()) {
if (identifier.contains(path)) {
affected.add(path);
}
}
- for (final InstanceIdentifier pathToRemove : affected) {
+ for (final YangInstanceIdentifier pathToRemove : affected) {
LOG.trace("Removed path {}", pathToRemove);
map.remove(pathToRemove);
}
import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class HashMapDataStoreTransaction implements
- DataCommitTransaction<InstanceIdentifier, CompositeNode> {
- private final DataModification<InstanceIdentifier, CompositeNode> modification;
+ DataCommitTransaction<YangInstanceIdentifier, CompositeNode> {
+ private final DataModification<YangInstanceIdentifier, CompositeNode> modification;
private final HashMapDataStore datastore;
HashMapDataStoreTransaction(
- final DataModification<InstanceIdentifier, CompositeNode> modify,
+ final DataModification<YangInstanceIdentifier, CompositeNode> modify,
final HashMapDataStore store) {
modification = modify;
datastore = store;
}
@Override
- public DataModification<InstanceIdentifier, CompositeNode> getModification() {
+ public DataModification<YangInstanceIdentifier, CompositeNode> getModification() {
return this.modification;
}
import org.opendaylight.controller.sal.core.api.RpcImplementation;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
class RoutedRpcRegImpl extends AbstractObjectRegistration<RpcImplementation> implements
RoutedRpcRegistration {
}
@Override
- public void registerPath(final QName context, final InstanceIdentifier path) {
+ public void registerPath(final QName context, final YangInstanceIdentifier path) {
router.addPath(context, path, this);
}
@Override
- public void unregisterPath(final QName context, final InstanceIdentifier path) {
+ public void unregisterPath(final QName context, final YangInstanceIdentifier path) {
router.removePath(context, path, this);
}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import com.google.common.collect.ImmutableSet;
private final RpcRoutingStrategy strategy;
private final Set<QName> supportedRpcs;
private final RpcRoutingContext identifier;
- final ConcurrentMap<InstanceIdentifier, RoutedRpcRegImpl> implementations = new ConcurrentHashMap<>();
+ final ConcurrentMap<YangInstanceIdentifier, RoutedRpcRegImpl> implementations = new ConcurrentHashMap<>();
private final SchemaAwareRpcBroker router;
public RoutedRpcSelector(final RpcRoutingStrategy strategy, final SchemaAwareRpcBroker router) {
SimpleNode<?> routeContainer = inputContainer.getFirstSimpleByName(strategy.getLeaf());
checkArgument(routeContainer != null, "Leaf %s must be set with value", strategy.getLeaf());
Object route = routeContainer.getValue();
- checkArgument(route instanceof InstanceIdentifier,
+ checkArgument(route instanceof YangInstanceIdentifier,
"The routed node %s is not an instance identifier", route);
RpcImplementation potential = null;
if (route != null) {
}
}
if (potential == null) {
- return router.invokeRpc(rpc, (InstanceIdentifier) route, input);
+ return router.invokeRpc(rpc, (YangInstanceIdentifier) route, input);
}
checkState(potential != null, "No implementation is available for rpc:%s path:%s", rpc, route);
return potential.invokeRpc(rpc, input);
}
- public void addPath(final QName context, final InstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) {
+ public void addPath(final QName context, final YangInstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) {
//checkArgument(strategy.getContext().equals(context),"Supplied context is not supported.");
RoutedRpcRegImpl previous = implementations.put(path, routedRpcRegImpl);
if (previous == null) {
}
- public void removePath(final QName context, final InstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) {
+ public void removePath(final QName context, final YangInstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) {
boolean removed = implementations.remove(path, routedRpcRegImpl);
if (removed) {
router.notifyPathWithdrawal(context, strategy.getIdentifier(), path);
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
private SchemaContext schema = null;
private boolean validationEnabled = false;
- private final DataReader<InstanceIdentifier, CompositeNode> reader = new MergeFirstLevelReader();
+ private final DataReader<YangInstanceIdentifier, CompositeNode> reader = new MergeFirstLevelReader();
@Override
- public boolean containsConfigurationPath(final InstanceIdentifier path) {
+ public boolean containsConfigurationPath(final YangInstanceIdentifier path) {
try {
getDelegateReadLock().lock();
return getDelegate().containsConfigurationPath(path);
}
@Override
- public boolean containsOperationalPath(final InstanceIdentifier path) {
+ public boolean containsOperationalPath(final YangInstanceIdentifier path) {
try {
getDelegateReadLock().lock();
return getDelegate().containsOperationalPath(path);
}
@Override
- public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
+ public Iterable<YangInstanceIdentifier> getStoredConfigurationPaths() {
try {
getDelegateReadLock().lock();
return getDelegate().getStoredConfigurationPaths();
}
@Override
- public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
+ public Iterable<YangInstanceIdentifier> getStoredOperationalPaths() {
try {
getDelegateReadLock().lock();
return getDelegate().getStoredOperationalPaths();
}
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
return reader.readConfigurationData(path);
}
@Override
- public CompositeNode readOperationalData(final InstanceIdentifier path) {
+ public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
return reader.readOperationalData(path);
}
@Override
- public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
- final DataModification<InstanceIdentifier, CompositeNode> modification) {
+ public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<YangInstanceIdentifier, CompositeNode> requestCommit(
+ final DataModification<YangInstanceIdentifier, CompositeNode> modification) {
validateAgainstSchema(modification);
NormalizedDataModification cleanedUp = prepareMergedTransaction(modification);
cleanedUp.status = TransactionStatus.SUBMITED;
this.validationEnabled = validationEnabled;
}
- private void validateAgainstSchema(final DataModification<InstanceIdentifier, CompositeNode> modification) {
+ private void validateAgainstSchema(final DataModification<YangInstanceIdentifier, CompositeNode> modification) {
if (!validationEnabled) {
return;
}
this.schema = null;
}
- protected CompositeNode mergeData(final InstanceIdentifier path, final CompositeNode stored, final CompositeNode modified,
+ protected CompositeNode mergeData(final YangInstanceIdentifier path, final CompositeNode stored, final CompositeNode modified,
final boolean config) {
// long startTime = System.nanoTime();
try {
}
}
- private DataSchemaNode schemaNodeFor(final InstanceIdentifier path) {
+ private DataSchemaNode schemaNodeFor(final YangInstanceIdentifier path) {
checkState(schema != null, "YANG Schema is not available");
return YangSchemaUtils.getSchemaNode(schema, path);
}
private NormalizedDataModification prepareMergedTransaction(
- final DataModification<InstanceIdentifier, CompositeNode> original) {
+ final DataModification<YangInstanceIdentifier, CompositeNode> original) {
NormalizedDataModification normalized = new NormalizedDataModification(original);
LOG.trace("Transaction: {} Removed Configuration {}, Removed Operational {}", original.getIdentifier(),
original.getRemovedConfigurationData(), original.getRemovedConfigurationData());
LOG.trace("Transaction: {} Updated Configuration {}, Updated Operational {}", original.getIdentifier(),
original.getUpdatedConfigurationData().entrySet(), original.getUpdatedOperationalData().entrySet());
- for (InstanceIdentifier entry : original.getRemovedConfigurationData()) {
+ for (YangInstanceIdentifier entry : original.getRemovedConfigurationData()) {
normalized.deepRemoveConfigurationData(entry);
}
- for (InstanceIdentifier entry : original.getRemovedOperationalData()) {
+ for (YangInstanceIdentifier entry : original.getRemovedOperationalData()) {
normalized.deepRemoveOperationalData(entry);
}
- for (Entry<InstanceIdentifier, CompositeNode> entry : original.getUpdatedConfigurationData().entrySet()) {
+ for (Entry<YangInstanceIdentifier, CompositeNode> entry : original.getUpdatedConfigurationData().entrySet()) {
normalized.putDeepConfigurationData(entry.getKey(), entry.getValue());
}
- for (Entry<InstanceIdentifier, CompositeNode> entry : original.getUpdatedOperationalData().entrySet()) {
+ for (Entry<YangInstanceIdentifier, CompositeNode> entry : original.getUpdatedOperationalData().entrySet()) {
normalized.putDeepOperationalData(entry.getKey(), entry.getValue());
}
return normalized;
}
- private Iterable<InstanceIdentifier> getConfigurationSubpaths(final InstanceIdentifier entry) {
+ private Iterable<YangInstanceIdentifier> getConfigurationSubpaths(final YangInstanceIdentifier entry) {
// FIXME: This should be replaced by index
- Iterable<InstanceIdentifier> paths = getStoredConfigurationPaths();
+ Iterable<YangInstanceIdentifier> paths = getStoredConfigurationPaths();
return getChildrenPaths(entry, paths);
}
- public Iterable<InstanceIdentifier> getOperationalSubpaths(final InstanceIdentifier entry) {
+ public Iterable<YangInstanceIdentifier> getOperationalSubpaths(final YangInstanceIdentifier entry) {
// FIXME: This should be indexed
- Iterable<InstanceIdentifier> paths = getStoredOperationalPaths();
+ Iterable<YangInstanceIdentifier> paths = getStoredOperationalPaths();
return getChildrenPaths(entry, paths);
}
- private static final Iterable<InstanceIdentifier> getChildrenPaths(final InstanceIdentifier entry,
- final Iterable<InstanceIdentifier> paths) {
- ImmutableSet.Builder<InstanceIdentifier> children = ImmutableSet.builder();
- for (InstanceIdentifier potential : paths) {
+ private static final Iterable<YangInstanceIdentifier> getChildrenPaths(final YangInstanceIdentifier entry,
+ final Iterable<YangInstanceIdentifier> paths) {
+ ImmutableSet.Builder<YangInstanceIdentifier> children = ImmutableSet.builder();
+ for (YangInstanceIdentifier potential : paths) {
if (entry.contains(potential)) {
children.add(entry);
}
return children.build();
}
- private final Comparator<Entry<InstanceIdentifier, CompositeNode>> preparationComparator = new Comparator<Entry<InstanceIdentifier, CompositeNode>>() {
+ private final Comparator<Entry<YangInstanceIdentifier, CompositeNode>> preparationComparator = new Comparator<Entry<YangInstanceIdentifier, CompositeNode>>() {
@Override
- public int compare(final Entry<InstanceIdentifier, CompositeNode> o1, final Entry<InstanceIdentifier, CompositeNode> o2) {
- InstanceIdentifier o1Key = o1.getKey();
- InstanceIdentifier o2Key = o2.getKey();
+ public int compare(final Entry<YangInstanceIdentifier, CompositeNode> o1, final Entry<YangInstanceIdentifier, CompositeNode> o2) {
+ YangInstanceIdentifier o1Key = o1.getKey();
+ YangInstanceIdentifier o2Key = o2.getKey();
return Integer.compare(o1Key.getPath().size(), o2Key.getPath().size());
}
};
- private class MergeFirstLevelReader implements DataReader<InstanceIdentifier, CompositeNode> {
+ private class MergeFirstLevelReader implements DataReader<YangInstanceIdentifier, CompositeNode> {
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
getDelegateReadLock().lock();
try {
if (Iterables.isEmpty(path.getPathArguments())) {
qname = path.getPath().get(path.getPath().size() - 1).getNodeType();
}
- FluentIterable<InstanceIdentifier> directChildren = FluentIterable.from(getStoredConfigurationPaths())
- .filter(new Predicate<InstanceIdentifier>() {
+ FluentIterable<YangInstanceIdentifier> directChildren = FluentIterable.from(getStoredConfigurationPaths())
+ .filter(new Predicate<YangInstanceIdentifier>() {
@Override
- public boolean apply(final InstanceIdentifier input) {
+ public boolean apply(final YangInstanceIdentifier input) {
if (path.contains(input)) {
int nesting = input.getPath().size() - path.getPath().size();
if (nesting == 1) {
return false;
}
});
- for (InstanceIdentifier instanceIdentifier : directChildren) {
+ for (YangInstanceIdentifier instanceIdentifier : directChildren) {
childNodes.add(getDelegate().readConfigurationData(instanceIdentifier));
}
if (original == null && childNodes.isEmpty()) {
}
@Override
- public CompositeNode readOperationalData(final InstanceIdentifier path) {
+ public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
getDelegateReadLock().lock();
try {
if (Iterables.isEmpty(path.getPathArguments())) {
qname = path.getPath().get(path.getPath().size() - 1).getNodeType();
}
- FluentIterable<InstanceIdentifier> directChildren = FluentIterable.from(getStoredOperationalPaths())
- .filter(new Predicate<InstanceIdentifier>() {
+ FluentIterable<YangInstanceIdentifier> directChildren = FluentIterable.from(getStoredOperationalPaths())
+ .filter(new Predicate<YangInstanceIdentifier>() {
@Override
- public boolean apply(final InstanceIdentifier input) {
+ public boolean apply(final YangInstanceIdentifier input) {
if (path.contains(input)) {
int nesting = input.getPath().size() - path.getPath().size();
if (nesting == 1) {
}
});
- for (InstanceIdentifier instanceIdentifier : directChildren) {
+ for (YangInstanceIdentifier instanceIdentifier : directChildren) {
childNodes.add(getDelegate().readOperationalData(instanceIdentifier));
}
if (original == null && childNodes.isEmpty()) {
}
}
- private class NormalizedDataModification extends AbstractDataModification<InstanceIdentifier, CompositeNode> {
+ private class NormalizedDataModification extends AbstractDataModification<YangInstanceIdentifier, CompositeNode> {
private final String CONFIGURATIONAL_DATA_STORE_MARKER = "configurational";
private final String OPERATIONAL_DATA_STORE_MARKER = "operational";
private final Object identifier;
private TransactionStatus status;
- public NormalizedDataModification(final DataModification<InstanceIdentifier, CompositeNode> original) {
+ public NormalizedDataModification(final DataModification<YangInstanceIdentifier, CompositeNode> original) {
super(getDelegate());
identifier = original;
status = TransactionStatus.NEW;
*
* @param entry
*/
- public void deepRemoveOperationalData(final InstanceIdentifier entry) {
- Iterable<InstanceIdentifier> paths = getOperationalSubpaths(entry);
+ public void deepRemoveOperationalData(final YangInstanceIdentifier entry) {
+ Iterable<YangInstanceIdentifier> paths = getOperationalSubpaths(entry);
removeOperationalData(entry);
- for (InstanceIdentifier potential : paths) {
+ for (YangInstanceIdentifier potential : paths) {
removeOperationalData(potential);
}
}
- public void deepRemoveConfigurationData(final InstanceIdentifier entry) {
- Iterable<InstanceIdentifier> paths = getConfigurationSubpaths(entry);
+ public void deepRemoveConfigurationData(final YangInstanceIdentifier entry) {
+ Iterable<YangInstanceIdentifier> paths = getConfigurationSubpaths(entry);
removeConfigurationData(entry);
- for (InstanceIdentifier potential : paths) {
+ for (YangInstanceIdentifier potential : paths) {
removeConfigurationData(potential);
}
}
- public void putDeepConfigurationData(final InstanceIdentifier entryKey, final CompositeNode entryData) {
+ public void putDeepConfigurationData(final YangInstanceIdentifier entryKey, final CompositeNode entryData) {
this.putCompositeNodeData(entryKey, entryData, CONFIGURATIONAL_DATA_STORE_MARKER);
}
- public void putDeepOperationalData(final InstanceIdentifier entryKey, final CompositeNode entryData) {
+ public void putDeepOperationalData(final YangInstanceIdentifier entryKey, final CompositeNode entryData) {
this.putCompositeNodeData(entryKey, entryData, OPERATIONAL_DATA_STORE_MARKER);
}
}
@Override
- protected CompositeNode mergeConfigurationData(final InstanceIdentifier path, final CompositeNode stored,
+ protected CompositeNode mergeConfigurationData(final YangInstanceIdentifier path, final CompositeNode stored,
final CompositeNode modified) {
return mergeData(path, stored, modified, true);
}
@Override
- protected CompositeNode mergeOperationalData(final InstanceIdentifier path, final CompositeNode stored,
+ protected CompositeNode mergeOperationalData(final YangInstanceIdentifier path, final CompositeNode stored,
final CompositeNode modified) {
return mergeData(path, stored, modified, false);
}
- private void putData(final InstanceIdentifier entryKey, final CompositeNode entryData, final String dataStoreIdentifier) {
+ private void putData(final YangInstanceIdentifier entryKey, final CompositeNode entryData, final String dataStoreIdentifier) {
if (dataStoreIdentifier != null && entryKey != null && entryData != null) {
switch (dataStoreIdentifier) {
case (CONFIGURATIONAL_DATA_STORE_MARKER):
}
}
- private void putCompositeNodeData(final InstanceIdentifier entryKey, final CompositeNode entryData,
+ private void putCompositeNodeData(final YangInstanceIdentifier entryKey, final CompositeNode entryData,
final String dataStoreIdentifier) {
this.putData(entryKey, entryData, dataStoreIdentifier);
for (Node<?> child : entryData.getValue()) {
- InstanceIdentifier subEntryId = InstanceIdentifier.builder(entryKey).node(child.getNodeType())
+ YangInstanceIdentifier subEntryId = YangInstanceIdentifier.builder(entryKey).node(child.getNodeType())
.toInstance();
if (child instanceof CompositeNode) {
DataSchemaNode subSchema = schemaNodeFor(subEntryId);
CompositeNode compNode = (CompositeNode) child;
- InstanceIdentifier instanceId = null;
+ YangInstanceIdentifier instanceId = null;
if (subSchema instanceof ListSchemaNode) {
ListSchemaNode listSubSchema = (ListSchemaNode) subSchema;
Map<QName, Object> mapOfSubValues = this.getValuesFromListSchema(listSubSchema,
(CompositeNode) child);
if (mapOfSubValues != null) {
- instanceId = InstanceIdentifier.builder(entryKey)
+ instanceId = YangInstanceIdentifier.builder(entryKey)
.nodeWithKey(listSubSchema.getQName(), mapOfSubValues).toInstance();
}
} else if (subSchema instanceof ContainerSchemaNode) {
ContainerSchemaNode containerSchema = (ContainerSchemaNode) subSchema;
- instanceId = InstanceIdentifier.builder(entryKey).node(subSchema.getQName()).toInstance();
+ instanceId = YangInstanceIdentifier.builder(entryKey).node(subSchema.getQName()).toInstance();
}
if (instanceId != null) {
this.putCompositeNodeData(instanceId, compNode, dataStoreIdentifier);
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
private final ListenerRegistry<RpcRegistrationListener> rpcRegistrationListeners = new ListenerRegistry<>();
- private final ListenerRegistry<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeChangeListeners = new ListenerRegistry<>();
+ private final ListenerRegistry<RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> routeChangeListeners = new ListenerRegistry<>();
private final String identifier;
}
@Override
- public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(final QName rpc, final InstanceIdentifier route, final CompositeNode input) {
+ public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(final QName rpc, final YangInstanceIdentifier route, final CompositeNode input) {
checkState(defaultDelegate != null, "No implementation is available for rpc:%s path:%s", rpc, route);
return defaultDelegate.invokeRpc(rpc, route, input);
}
implementations.remove(registration.getType(), registration);
}
- void notifyPathAnnouncement(final QName context, final QName identifier, final InstanceIdentifier path) {
+ void notifyPathAnnouncement(final QName context, final QName identifier, final YangInstanceIdentifier path) {
RpcRoutingContext contextWrapped = RpcRoutingContext.create(context, identifier);
- RouteChange<RpcRoutingContext, InstanceIdentifier> change = RoutingUtils.announcementChange(contextWrapped , path);
- for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeListener : routeChangeListeners) {
+ RouteChange<RpcRoutingContext, YangInstanceIdentifier> change = RoutingUtils.announcementChange(contextWrapped , path);
+ for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> routeListener : routeChangeListeners) {
try {
routeListener.getInstance().onRouteChange(change);
} catch (Exception e) {
}
- void notifyPathWithdrawal(final QName context,final QName identifier, final InstanceIdentifier path) {
+ void notifyPathWithdrawal(final QName context,final QName identifier, final YangInstanceIdentifier path) {
RpcRoutingContext contextWrapped = RpcRoutingContext.create(context, identifier);
- RouteChange<RpcRoutingContext, InstanceIdentifier> change = RoutingUtils.removalChange(contextWrapped , path);
- for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeListener : routeChangeListeners) {
+ RouteChange<RpcRoutingContext, YangInstanceIdentifier> change = RoutingUtils.removalChange(contextWrapped , path);
+ for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> routeListener : routeChangeListeners) {
try {
routeListener.getInstance().onRouteChange(change);
} catch (Exception e) {
}
@Override
- public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+ public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
final L listener) {
ListenerRegistration<L> reg = routeChangeListeners.registerWithType(listener);
- RouteChange<RpcRoutingContext, InstanceIdentifier> initial = createInitialRouteChange();
+ RouteChange<RpcRoutingContext, YangInstanceIdentifier> initial = createInitialRouteChange();
try {
listener.onRouteChange(initial);
} catch (Exception e) {
return reg;
}
- private RouteChange<RpcRoutingContext, InstanceIdentifier> createInitialRouteChange() {
+ private RouteChange<RpcRoutingContext, YangInstanceIdentifier> createInitialRouteChange() {
FluentIterable<RoutedRpcSelector> rpcSelectors = FluentIterable.from(implementations.values()).filter(RoutedRpcSelector.class);
- ImmutableMap.Builder<RpcRoutingContext, Set<InstanceIdentifier>> announcements = ImmutableMap.builder();
- ImmutableMap.Builder<RpcRoutingContext, Set<InstanceIdentifier>> removals = ImmutableMap.builder();
+ ImmutableMap.Builder<RpcRoutingContext, Set<YangInstanceIdentifier>> announcements = ImmutableMap.builder();
+ ImmutableMap.Builder<RpcRoutingContext, Set<YangInstanceIdentifier>> removals = ImmutableMap.builder();
for (RoutedRpcSelector routedRpcSelector : rpcSelectors) {
final RpcRoutingContext context = routedRpcSelector.getIdentifier();
- final Set<InstanceIdentifier> paths = ImmutableSet.copyOf(routedRpcSelector.implementations.keySet());
+ final Set<YangInstanceIdentifier> paths = ImmutableSet.copyOf(routedRpcSelector.implementations.keySet());
announcements.put(context, paths);
}
return RoutingUtils.change(announcements.build(), removals.build());
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.osgi.framework.ServiceReference;
public class DOMDataBrokerProxy extends AbstractBrokerServiceProxy<DOMDataBroker> implements DOMDataBroker {
@Override
public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
- final InstanceIdentifier path, final DOMDataChangeListener listener,
+ final YangInstanceIdentifier path, final DOMDataChangeListener listener,
final org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope triggeringScope) {
return getDelegate().registerDataChangeListener(store, path, listener, triggeringScope);
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+package org.opendaylight.controller.sal.dom.broker.osgi;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.osgi.framework.ServiceReference;
+
+public class DOMMountPointServiceProxy extends AbstractBrokerServiceProxy<DOMMountPointService> implements DOMMountPointService{
+
+
+ public DOMMountPointServiceProxy(final ServiceReference<DOMMountPointService> ref, final DOMMountPointService delegate) {
+ super(ref, delegate);
+ }
+
+ @Override
+ public Optional<DOMMountPoint> getMountPoint(final YangInstanceIdentifier path) {
+ return getDelegate().getMountPoint(path);
+ }
+
+ @Override
+ public DOMMountPointBuilder createMountPoint(final YangInstanceIdentifier path) {
+ return getDelegate().createMountPoint(path);
+ }
+
+ public ListenerRegistration<MountProvisionListener> registerProvisionListener(final MountProvisionListener listener) {
+ return getDelegate().registerProvisionListener(listener);
+ }
+}
import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.osgi.framework.ServiceReference;
public class DataBrokerServiceProxy extends AbstractBrokerServiceProxy<DataBrokerService> implements DataBrokerService {
super(ref, delegate);
}
- public ListenerRegistration<DataChangeListener> registerDataChangeListener(InstanceIdentifier path,
+ public ListenerRegistration<DataChangeListener> registerDataChangeListener(YangInstanceIdentifier path,
DataChangeListener listener) {
return addRegistration(getDelegate().registerDataChangeListener(path, listener));
}
- public CompositeNode readConfigurationData(InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(YangInstanceIdentifier path) {
return getDelegate().readConfigurationData(path);
}
- public CompositeNode readOperationalData(InstanceIdentifier path) {
+ public CompositeNode readOperationalData(YangInstanceIdentifier path) {
return getDelegate().readOperationalData(path);
}
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.osgi.framework.ServiceReference;
public class DataProviderServiceProxy extends AbstractBrokerServiceProxy<DataProviderService> implements
super(ref, delegate);
}
- public ListenerRegistration<DataChangeListener> registerDataChangeListener(InstanceIdentifier path,
+ public ListenerRegistration<DataChangeListener> registerDataChangeListener(YangInstanceIdentifier path,
DataChangeListener listener) {
return addRegistration(getDelegate().registerDataChangeListener(path, listener));
}
- public CompositeNode readConfigurationData(InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(YangInstanceIdentifier path) {
return getDelegate().readConfigurationData(path);
}
- public CompositeNode readOperationalData(InstanceIdentifier path) {
+ public CompositeNode readOperationalData(YangInstanceIdentifier path) {
return getDelegate().readOperationalData(path);
}
@Override
public Registration registerCommitHandler(
- InstanceIdentifier path, DataCommitHandler<InstanceIdentifier, CompositeNode> commitHandler) {
+ YangInstanceIdentifier path, DataCommitHandler<YangInstanceIdentifier, CompositeNode> commitHandler) {
return addRegistration(getDelegate().registerCommitHandler(path, commitHandler));
}
@Override
public Registration registerConfigurationReader(
- InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
+ YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader) {
return addRegistration(getDelegate().registerConfigurationReader(path, reader));
}
@Override
public Registration registerOperationalReader(
- InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
+ YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader) {
return addRegistration(getDelegate().registerOperationalReader(path, reader));
}
}
@Override
- public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
- RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>> commitHandlerListener) {
+ public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
+ RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>> commitHandlerListener) {
return addRegistration(getDelegate().registerCommitHandlerListener(commitHandlerListener));
}
}
import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.osgi.framework.ServiceReference;
public class MountProviderServiceProxy extends AbstractBrokerServiceProxy<MountProvisionService> implements MountProvisionService{
}
@Override
- public MountProvisionInstance getMountPoint(InstanceIdentifier path) {
+ public MountProvisionInstance getMountPoint(YangInstanceIdentifier path) {
return getDelegate().getMountPoint(path);
}
@Override
- public MountProvisionInstance createMountPoint(InstanceIdentifier path) {
+ public MountProvisionInstance createMountPoint(YangInstanceIdentifier path) {
return getDelegate().createMountPoint(path);
}
@Override
- public MountProvisionInstance createOrGetMountPoint(InstanceIdentifier path) {
+ public MountProvisionInstance createOrGetMountPoint(YangInstanceIdentifier path) {
return getDelegate().createOrGetMountPoint(path);
}
import java.util.Arrays;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.sal.core.api.BrokerService;
import org.osgi.framework.ServiceReference;
import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
((ServiceReference<MountProvisionService>) ref), service);
}
+ private static Object _createProxyImpl(final ServiceReference<?> ref,
+ final DOMMountPointService service) {
+
+ return new DOMMountPointServiceProxy(
+ ((ServiceReference<DOMMountPointService>) ref), service);
+ }
+
private static Object _createProxyImpl(final ServiceReference<?> ref,
final SchemaService service) {
return _createProxyImpl(ref, (SchemaService) service);
} else if (service instanceof NotificationService) {
return _createProxyImpl(ref, (NotificationService) service);
+ } else if (service instanceof DOMMountPointService) {
+ return _createProxyImpl(ref, (DOMMountPointService) service);
} else if (service != null) {
return _createProxyImpl(ref, service);
} else {
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.osgi.framework.ServiceReference;
import com.google.common.util.concurrent.ListenableFuture;
}
@Override
- public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(final L listener) {
+ public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(final L listener) {
return getDelegate().registerRouteChangeListener(listener);
}
import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
import org.opendaylight.controller.sal.core.api.RpcImplementation;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public interface RoutedRpcProcessor extends RpcImplementation {
QName getRpcType();
- Map<InstanceIdentifier,RpcImplementation> getRoutes();
+ Map<YangInstanceIdentifier,RpcImplementation> getRoutes();
RpcImplementation getDefaultRoute();
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+
+package org.opendaylight.controller.sal.dom.broker.util;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
+import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
+import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.UsesNode;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+
+/**
+ * ProxySchema Context for SchemaContextProviders
+ */
+public class ProxySchemaContext implements SchemaContext {
+
+ private final SchemaContextProvider schemaProvider;
+
+ public ProxySchemaContext(final SchemaContextProvider schemaProvider) {
+ this.schemaProvider = schemaProvider;
+ }
+
+ private SchemaContext getCurrentSchema() {
+ Preconditions.checkState(schemaProvider.getSchemaContext() != null, "Schema context unavailable from %s", schemaProvider);
+ return schemaProvider.getSchemaContext();
+ }
+
+ @Override
+ public Set<DataSchemaNode> getDataDefinitions() {
+ return getCurrentSchema().getDataDefinitions();
+ }
+
+ @Override
+ public Set<Module> getModules() {
+ return getCurrentSchema().getModules();
+ }
+
+ @Override
+ public Set<NotificationDefinition> getNotifications() {
+ return getCurrentSchema().getNotifications();
+ }
+
+ @Override
+ public Set<RpcDefinition> getOperations() {
+ return getCurrentSchema().getOperations();
+ }
+
+ @Override
+ public Set<ExtensionDefinition> getExtensions() {
+ return getCurrentSchema().getExtensions();
+ }
+
+ @Override
+ public Module findModuleByName(final String s, final Date date) {
+ return getCurrentSchema().findModuleByName(s, date);
+ }
+
+ @Override
+ public Set<Module> findModuleByNamespace(final URI uri) {
+ return getCurrentSchema().findModuleByNamespace(uri);
+ }
+
+ @Override
+ public Module findModuleByNamespaceAndRevision(final URI uri, final Date date) {
+ return getCurrentSchema().findModuleByNamespaceAndRevision(uri, date);
+ }
+
+ @Override
+ public Optional<String> getModuleSource(final ModuleIdentifier moduleIdentifier) {
+ return getCurrentSchema().getModuleSource(moduleIdentifier);
+ }
+
+ @Override
+ public Set<ModuleIdentifier> getAllModuleIdentifiers() {
+ return getCurrentSchema().getAllModuleIdentifiers();
+ }
+
+ @Override
+ public boolean isPresenceContainer() {
+ return getCurrentSchema().isPresenceContainer();
+ }
+
+ @Override
+ public Set<TypeDefinition<?>> getTypeDefinitions() {
+ return getCurrentSchema().getTypeDefinitions();
+ }
+
+ @Override
+ public Collection<DataSchemaNode> getChildNodes() {
+ return getCurrentSchema().getChildNodes();
+ }
+
+ @Override
+ public Set<GroupingDefinition> getGroupings() {
+ return getCurrentSchema().getGroupings();
+ }
+
+ @Override
+ public DataSchemaNode getDataChildByName(final QName qName) {
+ return getCurrentSchema().getDataChildByName(qName);
+ }
+
+ @Override
+ public DataSchemaNode getDataChildByName(final String s) {
+ return getCurrentSchema().getDataChildByName(s);
+ }
+
+ @Override
+ public Set<UsesNode> getUses() {
+ return getCurrentSchema().getUses();
+ }
+
+ @Override
+ public Set<AugmentationSchema> getAvailableAugmentations() {
+ return getCurrentSchema().getAvailableAugmentations();
+ }
+
+ @Override
+ public boolean isAugmenting() {
+ return getCurrentSchema().isAugmenting();
+ }
+
+ @Override
+ public boolean isAddedByUses() {
+ return getCurrentSchema().isAddedByUses();
+ }
+
+ @Override
+ public boolean isConfiguration() {
+ return getCurrentSchema().isConfiguration();
+ }
+
+ @Override
+ public ConstraintDefinition getConstraints() {
+ return getCurrentSchema().getConstraints();
+ }
+
+ @Override
+ public QName getQName() {
+ return getCurrentSchema().getQName();
+ }
+
+ @Override
+ public SchemaPath getPath() {
+ return getCurrentSchema().getPath();
+ }
+
+ @Override
+ public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+ return getCurrentSchema().getUnknownSchemaNodes();
+ }
+
+ @Override
+ public String getDescription() {
+ return getCurrentSchema().getDescription();
+ }
+
+ @Override
+ public String getReference() {
+ return getCurrentSchema().getReference();
+ }
+
+ @Override
+ public Status getStatus() {
+ return getCurrentSchema().getStatus();
+ }
+}
import java.util.Set;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
throw new UnsupportedOperationException("Utility class.");
}
- public static DataSchemaNode getSchemaNode(final SchemaContext schema,final InstanceIdentifier path) {
+ public static DataSchemaNode getSchemaNode(final SchemaContext schema,final YangInstanceIdentifier path) {
checkArgument(schema != null,"YANG Schema must not be null.");
checkArgument(path != null,"Path must not be null.");
return getSchemaNode(schema, FluentIterable.from(path.getPathArguments()).transform(QNAME_FROM_PATH_ARGUMENT));
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
import org.opendaylight.controller.md.sal.dom.store.impl.TestModel;
import org.opendaylight.controller.sal.core.spi.data.DOMStore;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
return ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i);
}
- private static InstanceIdentifier outerListPath(final int i) {
- return InstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)//
+ private static YangInstanceIdentifier outerListPath(final int i) {
+ return YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)//
.nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i) //
.build();
}
int i = 0;
for (DOMDataReadWriteTransaction writeTx :transactions) {
// Writes /test/outer-list/i in writeTx
- InstanceIdentifier path = InstanceIdentifier.builder(outerListPath(i))
+ YangInstanceIdentifier path = YangInstanceIdentifier.builder(outerListPath(i))
.node(TestModel.INNER_LIST_QNAME).build();
writeTx.put(OPERATIONAL, path, ImmutableNodes.mapNodeBuilder(TestModel.INNER_LIST_QNAME).build());
for (int j = 0; j < innerNum; j++) {
- InstanceIdentifier innerPath = InstanceIdentifier.builder(path)
+ YangInstanceIdentifier innerPath = YangInstanceIdentifier.builder(path)
.nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, String.valueOf(j))
.build();
writeTx.put(
public Void call() throws Exception {
for (int i = 0; i < txNum; i++) {
for (int j = 0; j < innerNum; j++) {
- InstanceIdentifier path = InstanceIdentifier
+ YangInstanceIdentifier path = YangInstanceIdentifier
.builder(outerListPath(i))
//
.node(TestModel.INNER_LIST_QNAME)
import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService.DOMMountPointBuilder;
import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class MountPointServiceTest {
private DOMMountPointService mountService;
- private static final InstanceIdentifier PATH = InstanceIdentifier.of(QName.create("namespace", "12-12-2012", "top"));
+ private static final YangInstanceIdentifier PATH = YangInstanceIdentifier.of(QName.create("namespace", "12-12-2012", "top"));
@Before
public void setup() {
package org.opendaylight.controller.md.sal.dom.store.impl;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
- public static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
- public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+ public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
+ public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
public static final QName TWO_QNAME = QName.create(TEST_QNAME,"two");
public static final QName THREE_QNAME = QName.create(TEST_QNAME,"three");
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+
+package org.opendaylight.controller.sal.dom.broker;
+
+import static junit.framework.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.md.sal.dom.api.DOMService;
+import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+
+public class BackwardsCompatibleMountPointManagerTest {
+ private static final Logger log = LoggerFactory.getLogger(BackwardsCompatibleMountPointManagerTest.class);
+
+ @Mock
+ private DOMMountPointServiceImpl domMountPointService;
+ @Mock
+ private DOMMountPointService.DOMMountPointBuilder mountBuilder;
+
+ private BackwardsCompatibleMountPointManager compatibleMountPointManager;
+ static final QName qName = QName.create("namespace", "12-12-1212", "mount");
+ static final YangInstanceIdentifier id = YangInstanceIdentifier.builder(qName).build();
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ stubMountService();
+ compatibleMountPointManager = new BackwardsCompatibleMountPointManager(domMountPointService);
+ }
+
+ @Test
+ public void testCreateMountpointAlreadyCreated() throws Exception {
+ compatibleMountPointManager.createMountPoint(id);
+ verify(domMountPointService).createMountPoint(id);
+ verify(mountBuilder, times(3)).addService(any(Class.class), any(DOMService.class));
+ verify(mountBuilder).addInitialSchemaContext(any(SchemaContext.class));
+
+ try {
+ compatibleMountPointManager.createMountPoint(id);
+ } catch (final IllegalStateException e) {
+ log.debug("", e);
+ return;
+ }
+ fail("Should fail to create duplicate mount");
+ }
+
+ @Test
+ public void testCreateMountpointGetOrCreate() throws Exception {
+ compatibleMountPointManager = new BackwardsCompatibleMountPointManager(new DOMMountPointServiceImpl());
+
+ final MountProvisionListener listener = new MountProvisionListener() {
+ public int createdMounts = 0;
+
+ @Override
+ public void onMountPointCreated(final YangInstanceIdentifier path) {
+ if(createdMounts++ > 1 ) {
+ fail("Only one mount point should have been created");
+ }
+ }
+
+ @Override
+ public void onMountPointRemoved(final YangInstanceIdentifier path) {}
+ };
+
+ compatibleMountPointManager.registerProvisionListener(listener);
+
+ final MountProvisionInstance m1 = compatibleMountPointManager.createOrGetMountPoint(id);
+ m1.setSchemaContext(mockSchemaContext());
+ compatibleMountPointManager.createOrGetMountPoint(id);
+ compatibleMountPointManager.createOrGetMountPoint(id);
+ }
+
+ private void stubMountService() {
+ doReturn(mockMountPointBuilder()).when(domMountPointService).createMountPoint(any(YangInstanceIdentifier.class));
+ doReturn(Optional.of(mockMountPoint())).when(domMountPointService).getMountPoint(any(YangInstanceIdentifier.class));
+ }
+
+ private DOMMountPoint mockMountPoint() {
+ final DOMMountPoint mock = mock(DOMMountPoint.class);
+ doAnswer(new Answer() {
+ @Override
+ public Object answer(final InvocationOnMock invocation) throws Throwable {
+ return Optional.of(mock(((Class<?>) invocation.getArguments()[0])));
+ }
+ }).when(mock).getService(any(Class.class));
+ doReturn(mockSchemaContext()).when(mock).getSchemaContext();
+ return mock;
+ }
+
+ static SchemaContext mockSchemaContext() {
+ final SchemaContext mock = mock(SchemaContext.class);
+ doReturn(qName).when(mock).getQName();
+ doReturn("schema").when(mock).toString();
+ doReturn(mock(DataSchemaNode.class)).when(mock).getDataChildByName(any(QName.class));
+ return mock;
+ }
+
+ private DOMMountPointService.DOMMountPointBuilder mockMountPointBuilder() {
+ doReturn(mountBuilder).when(mountBuilder).addService(any(Class.class), any(DOMService.class));
+ doReturn(mockObjectRegistration()).when(mountBuilder).register();
+ doReturn(mountBuilder).when(mountBuilder).addInitialSchemaContext(any(SchemaContext.class));
+ return mountBuilder;
+ }
+
+ private ObjectRegistration<?> mockObjectRegistration() {
+ return mock(ObjectRegistration.class);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+
+package org.opendaylight.controller.sal.dom.broker;
+
+import static junit.framework.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.AbstractMap;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.core.api.data.DataProviderService;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BackwardsCompatibleMountPointTest {
+ private static final Logger log = LoggerFactory.getLogger(BackwardsCompatibleMountPointManagerTest.class);
+
+ private static final YangInstanceIdentifier id = BackwardsCompatibleMountPointManagerTest.id;
+ private final NormalizedNode<?, ?> normalizedNode = mockNormalizedNode();
+ private final CompositeNode compositeNode = mockCompositeNode();
+
+ @Mock
+ private DataProviderService oldBroker;
+ @Mock
+ private SchemaContextProvider schemaContextProvider;
+ @Mock
+ private DataModificationTransaction mockTx;
+
+ private BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore backwardsCompatibleDomStore;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ stubSchemaProvider();
+ stubOldBroker();
+ backwardsCompatibleDomStore = new BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore(oldBroker, schemaContextProvider);
+ }
+
+ private void stubOldBroker() {
+ doReturn(compositeNode).when(oldBroker).readConfigurationData(id);
+ doReturn(compositeNode).when(oldBroker).readOperationalData(id);
+ doReturn(mockTx).when(oldBroker).beginTransaction();
+ doNothing().when(mockTx).putConfigurationData(id, compositeNode);
+ doNothing().when(mockTx).putOperationalData(id, compositeNode);
+ doReturn(com.google.common.util.concurrent.Futures.immediateFuture(RpcResultBuilder.success(TransactionStatus.COMMITED))).when(mockTx).commit();
+ }
+
+ private CompositeNode mockCompositeNode() {
+ final CompositeNode mock = mock(CompositeNode.class);
+ doReturn("node").when(mock).toString();
+ return mock;
+ }
+
+ private void stubSchemaProvider() {
+ doReturn(BackwardsCompatibleMountPointManagerTest.mockSchemaContext()).when(schemaContextProvider).getSchemaContext();
+ }
+
+ @Test
+ public void testBackwardsCompatibleBroker() throws Exception {
+ backwardsCompatibleDomStore.newReadOnlyTransaction();
+ backwardsCompatibleDomStore.newWriteOnlyTransaction();
+ backwardsCompatibleDomStore.newReadWriteTransaction();
+ }
+
+ @Test
+ public void testReadTransaction() throws Exception {
+ final BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleReadTransaction tx =
+ new BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleReadTransaction(oldBroker, mockNormalizer());
+
+ ListenableFuture<Optional<NormalizedNode<?, ?>>> read = tx.read(LogicalDatastoreType.CONFIGURATION, id);
+ assertEquals(normalizedNode, read.get().get());
+ verify(oldBroker).readConfigurationData(id);
+
+ read = tx.read(LogicalDatastoreType.OPERATIONAL, id);
+ assertEquals(normalizedNode, read.get().get());
+
+ verify(oldBroker).readOperationalData(id);
+ }
+
+ @Test
+ public void testReadWriteTransactionOperational() throws Exception {
+ final BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleWriteTransaction tx =
+ new BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleWriteTransaction(oldBroker, mockNormalizer());
+
+ verify(oldBroker).beginTransaction();
+
+ tx.put(LogicalDatastoreType.CONFIGURATION, id, normalizedNode);
+ verify(mockTx).putConfigurationData(id, compositeNode);
+
+ tx.put(LogicalDatastoreType.CONFIGURATION, id, normalizedNode);
+ verify(mockTx, times(2)).putConfigurationData(id, compositeNode);
+
+ tx.commit();
+ verify(mockTx).commit();
+ }
+
+
+ @Test
+ public void testCannotPutOperational() throws Exception {
+ final BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleWriteTransaction tx =
+ new BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleWriteTransaction(oldBroker, mockNormalizer());
+
+ try {
+ tx.put(LogicalDatastoreType.OPERATIONAL, id, normalizedNode);
+ } catch (IllegalArgumentException e) {
+ // Cannot put operational data
+ log.debug("", e);
+ return;
+ }
+
+ fail("Should fail when putting operational data");
+ }
+
+ private DataNormalizer mockNormalizer() throws DataNormalizationException {
+ final DataNormalizer mock = mock(DataNormalizer.class);
+ doReturn(new AbstractMap.SimpleEntry<YangInstanceIdentifier, NormalizedNode<?, ?>>(id, normalizedNode) {})
+ .when(mock).toNormalized(any(YangInstanceIdentifier.class), any(CompositeNode.class));
+ doReturn(compositeNode).when(mock).toLegacy(any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+ doReturn(id).when(mock).toLegacy(any(YangInstanceIdentifier.class));
+ return mock;
+ }
+
+ private NormalizedNode<?, ?> mockNormalizedNode() {
+ final NormalizedNode mock = mock(NormalizedNode.class);
+ doReturn("mockNormalizedNode").when(mock).toString();
+ return mock;
+ }
+}
import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
import org.opendaylight.controller.md.sal.dom.api.DOMService;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import com.google.common.base.Optional;
public class SimpleDOMMountPoint implements DOMMountPoint {
- private final InstanceIdentifier identifier;
+ private final YangInstanceIdentifier identifier;
private final ClassToInstanceMap<DOMService> services;
private final SchemaContext schemaContext;
- public static final SimpleDOMMountPoint create(final InstanceIdentifier identifier, final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
+ public static final SimpleDOMMountPoint create(final YangInstanceIdentifier identifier, final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
return new SimpleDOMMountPoint(identifier, services, ctx);
}
- private SimpleDOMMountPoint(final InstanceIdentifier identifier, final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
+ private SimpleDOMMountPoint(final YangInstanceIdentifier identifier, final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
this.identifier = identifier;
this.services = ImmutableClassToInstanceMap.copyOf(services);
this.schemaContext = ctx;
}
@Override
- public InstanceIdentifier getIdentifier() {
+ public YangInstanceIdentifier getIdentifier() {
return identifier;
}
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* registration / interest on receiving data changes.
*
*/
- <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
- InstanceIdentifier path, L listener, DataChangeScope scope);
+ <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
+ YangInstanceIdentifier path, L listener, DataChangeScope scope);
/**
*
*/
package org.opendaylight.controller.sal.core.spi.data;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Optional;
* {@link java.util.concurrent.Future#get()} returns {@link Optional#absent()}.
* </ul>
*/
- ListenableFuture<Optional<NormalizedNode<?,?>>> read(InstanceIdentifier path);
+ ListenableFuture<Optional<NormalizedNode<?,?>>> read(YangInstanceIdentifier path);
}
*/
package org.opendaylight.controller.sal.core.spi.data;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public interface DOMStoreWriteTransaction extends DOMStoreTransaction {
* if the client code already sealed transaction and invoked
* {@link #ready()}
*/
- void write(InstanceIdentifier path, NormalizedNode<?, ?> data);
+ void write(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
/**
* Store a provided data at specified path. This acts as a add / replace
* if the client code already sealed transaction and invoked
* {@link #ready()}
*/
- void merge(InstanceIdentifier path, NormalizedNode<?, ?> data);
+ void merge(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
/**
*
* if the client code already sealed transaction and invoked
* {@link #ready()}
*/
- void delete(InstanceIdentifier path);
+ void delete(YangInstanceIdentifier path);
/**
*
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <fileset name="all" enabled="true" check-config-name="Sun Checks" local="false">
+ <file-match-pattern match-pattern=".*" include-pattern="true"/>
+ </fileset>
+</fileset-config>
--- /dev/null
+/target-ide
--- /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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-parent</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>sal-dom-xsql</artifactId>
+ <packaging>bundle</packaging>
+ <name>sal-dom-xsql</name>
+ <description>XSQL language</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-config</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>yang-jmx-generator-plugin</artifactId>
+ <version>${config.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-binding</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <yangFilesRootDir>src/main/yang</yangFilesRootDir>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+ <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+ <additionalConfiguration>
+ <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+ </additionalConfiguration>
+ </generator>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:XSQL</url>
+ <scm>
+ <developerConnection>Sharon Aicler</developerConnection>
+ <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:XSQL</url>
+ </scm>
+</project>
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Map;
+
+public class TablesResultSet implements ResultSet {
+
+ private String tables[] = null;
+ private int pos = -1;
+
+ public TablesResultSet(XSQLBluePrint cache) {
+ //tables = cache.getInterfaceNames();
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean next() throws SQLException {
+ if (tables == null) {
+ return false;
+ }
+ pos++;
+ if (pos >= tables.length) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public void close() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean wasNull() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String getString(int columnIndex) throws SQLException {
+ return tables[pos];
+ }
+
+ @Override
+ public boolean getBoolean(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public byte getByte(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public short getShort(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getInt(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public long getLong(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public float getFloat(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public double getDouble(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public BigDecimal getBigDecimal(int columnIndex, int scale)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public byte[] getBytes(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getDate(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Time getTime(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Timestamp getTimestamp(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getAsciiStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getBinaryStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getString(String columnLabel) throws SQLException {
+ return tables[pos];
+ }
+
+ @Override
+ public boolean getBoolean(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public byte getByte(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public short getShort(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getInt(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public long getLong(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public float getFloat(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public double getDouble(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public BigDecimal getBigDecimal(String columnLabel, int scale)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public byte[] getBytes(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getDate(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Time getTime(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Timestamp getTimestamp(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getAsciiStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getUnicodeStream(String columnLabel)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getBinaryStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SQLWarning getWarnings() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void clearWarnings() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getCursorName() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSetMetaData getMetaData() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getObject(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getObject(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int findColumn(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Reader getCharacterStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Reader getCharacterStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isBeforeFirst() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isAfterLast() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isFirst() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isLast() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void beforeFirst() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void afterLast() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean first() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean last() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int getRow() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean absolute(int row) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean relative(int rows) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean previous() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setFetchDirection(int direction) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getFetchDirection() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void setFetchSize(int rows) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getFetchSize() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getType() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getConcurrency() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean rowUpdated() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean rowInserted() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean rowDeleted() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void updateNull(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateByte(int columnIndex, byte x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateShort(int columnIndex, short x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateInt(int columnIndex, int x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateLong(int columnIndex, long x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateFloat(int columnIndex, float x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDouble(int columnIndex, double x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBigDecimal(int columnIndex, BigDecimal x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateString(int columnIndex, String x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDate(int columnIndex, Date x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateTime(int columnIndex, Time x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateTimestamp(int columnIndex, Timestamp x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(int columnIndex, InputStream x, int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(int columnIndex, InputStream x, int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(int columnIndex, Reader x, int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateObject(int columnIndex, Object x, int scaleOrLength)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateObject(int columnIndex, Object x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNull(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBoolean(String columnLabel, boolean x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateByte(String columnLabel, byte x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateShort(String columnLabel, short x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateInt(String columnLabel, int x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateLong(String columnLabel, long x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateFloat(String columnLabel, float x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDouble(String columnLabel, double x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBigDecimal(String columnLabel, BigDecimal x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateString(String columnLabel, String x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBytes(String columnLabel, byte[] x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDate(String columnLabel, Date x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateTime(String columnLabel, Time x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateTimestamp(String columnLabel, Timestamp x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(String columnLabel, InputStream x, int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(String columnLabel, InputStream x,
+ int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(String columnLabel, Reader reader,
+ int length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateObject(String columnLabel, Object x, int scaleOrLength)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateObject(String columnLabel, Object x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void insertRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void refreshRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void cancelRowUpdates() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void moveToInsertRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void moveToCurrentRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Statement getStatement() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getObject(int columnIndex, Map<String, Class<?>> map)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Ref getRef(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Blob getBlob(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Clob getClob(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Array getArray(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getObject(String columnLabel, Map<String, Class<?>> map)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Ref getRef(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Blob getBlob(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Clob getClob(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Array getArray(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Timestamp getTimestamp(int columnIndex, Calendar cal)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Timestamp getTimestamp(String columnLabel, Calendar cal)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public URL getURL(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public URL getURL(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void updateRef(int columnIndex, Ref x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateRef(String columnLabel, Ref x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(int columnIndex, Blob x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(String columnLabel, Blob x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(int columnIndex, Clob x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(String columnLabel, Clob x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateArray(int columnIndex, Array x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateArray(String columnLabel, Array x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public RowId getRowId(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public RowId getRowId(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void updateRowId(int columnIndex, RowId x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateRowId(String columnLabel, RowId x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getHoldability() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean isClosed() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void updateNString(int columnIndex, String nString)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNString(String columnLabel, String nString)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(String columnLabel, NClob nClob)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public NClob getNClob(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NClob getNClob(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SQLXML getSQLXML(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SQLXML getSQLXML(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void updateSQLXML(int columnIndex, SQLXML xmlObject)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateSQLXML(String columnLabel, SQLXML xmlObject)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getNString(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getNString(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Reader getNCharacterStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Reader getNCharacterStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void updateNCharacterStream(int columnIndex, Reader x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNCharacterStream(String columnLabel, Reader reader,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(int columnIndex, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(int columnIndex, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(int columnIndex, Reader x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(String columnLabel, InputStream x,
+ long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(String columnLabel, InputStream x,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(String columnLabel, Reader reader,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(int columnIndex, InputStream inputStream,
+ long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(String columnLabel, InputStream inputStream,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(int columnIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(String columnLabel, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(int columnIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(String columnLabel, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNCharacterStream(int columnIndex, Reader x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNCharacterStream(String columnLabel, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(int columnIndex, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(int columnIndex, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(int columnIndex, Reader x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(String columnLabel, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(String columnLabel, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(String columnLabel, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(int columnIndex, InputStream inputStream)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(String columnLabel, InputStream inputStream)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(int columnIndex, Reader reader) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(String columnLabel, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(int columnIndex, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(String columnLabel, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> T getObject(String columnLabel, Class<T> type)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
+
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadTransaction;
+import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCResultSet;
+import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCServer;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+
+public class XSQLAdapter extends Thread implements SchemaContextListener {
+
+ private static final int SLEEP = 10000;
+ private static XSQLAdapter a = new XSQLAdapter();
+ private static PrintStream l = null;
+ public boolean stopped = false;
+ private List<String> elementHosts = new ArrayList<String>();
+ private String username;
+ private String password;
+ private String transport = "tcp";
+ private int reconnectTimeout;
+ private int nThreads;
+ private int qsize;
+ private String applicationName = "NQL Adapter";
+ private Map<String, NEEntry> elements = new ConcurrentHashMap<String, XSQLAdapter.NEEntry>();
+ private StringBuffer lastInputString = new StringBuffer();
+ private XSQLBluePrint bluePrint = new XSQLBluePrint();
+ private boolean toCsv = false;
+ private String exportToFileName = null;
+ private XSQLThreadPool threadPool = new XSQLThreadPool(1, "Tasks", 2000);
+ private JDBCServer jdbcServer = new JDBCServer(this);
+ private String pinningFile;
+ private ServerSocket serverSocket = null;
+ private DOMDataBroker domDataBroker = null;
+
+ private XSQLAdapter() {
+ XSQLAdapter.log("Starting Adapter");
+ this.setDaemon(true);
+ try {
+ serverSocket = new ServerSocket(34343);
+ } catch (Exception err) {
+ XSQLAdapter.log(err);
+ }
+ this.start();
+ XSQLAdapter.log("Adapter Started!");
+
+ }
+
+ public static XSQLAdapter getInstance() {
+ return a;
+ }
+
+ public static void main(String args[]) {
+ XSQLAdapter adapter = new XSQLAdapter();
+ adapter.start();
+ }
+
+ public static void log(String str) {
+ try {
+ if (l == null) {
+ synchronized (XSQLAdapter.class) {
+ if (l == null) {
+ l = new PrintStream(
+ new FileOutputStream("/tmp/xql.log"));
+ }
+ }
+ }
+ l.print(Calendar.getInstance().getTime());
+ l.print(" - ");
+ l.println(str);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ public static void log(Exception e) {
+ try {
+ if (l == null) {
+ synchronized (XSQLAdapter.class) {
+ if (l == null) {
+ l = new PrintStream(
+ new FileOutputStream("/tmp/xql.log"));
+ }
+ }
+ }
+ l.print(Calendar.getInstance().getTime());
+ l.print(" - ");
+ e.printStackTrace(l);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onGlobalContextUpdated(SchemaContext context) {
+ Set<Module> modules = context.getModules();
+ for (Module m : modules) {
+ if (XSQLODLUtils.createOpenDaylightCache(this.bluePrint, m)) {
+ this.addRootElement(m);
+ }
+ }
+ }
+
+ public void setDataBroker(DOMDataBroker ddb) {
+ this.domDataBroker = ddb;
+ }
+
+ public XSQLBluePrint getBluePrint() {
+ return this.bluePrint;
+ }
+
+ public List<Object> collectModuleRoots(XSQLBluePrintNode table) {
+ if (table.getParent().isModule()) {
+ try {
+ List<Object> result = new LinkedList<Object>();
+ YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier
+ .builder()
+ .node(XSQLODLUtils.getPath(table.getODLNode()).get(0))
+ .toInstance();
+ DOMDataReadTransaction t = this.domDataBroker
+ .newReadOnlyTransaction();
+ Object node = t.read(LogicalDatastoreType.OPERATIONAL,
+ instanceIdentifier).get();
+ node = XSQLODLUtils.get(node, "reference");
+ if (node == null) {
+ return result;
+ }
+
+ // XSQLAdapter.log(""+node);
+ Map<?, ?> children = XSQLODLUtils.getChildren(node);
+ for (Object c : children.values()) {
+ Map<?, ?> sons = XSQLODLUtils.getChildren(c);
+ for (Object child : sons.values()) {
+ result.add(child);
+ }
+ }
+
+ return result;
+ } catch (Exception err) {
+ XSQLAdapter.log(err);
+ }
+ } else {
+ return collectModuleRoots(table.getParent());
+ }
+ return null;
+ }
+
+ public void execute(JDBCResultSet rs) {
+ List<XSQLBluePrintNode> tables = rs.getTables();
+ List<Object> roots = collectModuleRoots(tables.get(0));
+ XSQLBluePrintNode main = rs.getMainTable();
+ List<NETask> tasks = new LinkedList<XSQLAdapter.NETask>();
+
+ for (Object entry : roots) {
+ NETask task = new NETask(rs, entry, main, bluePrint);
+ rs.numberOfTasks++;
+ tasks.add(task);
+ }
+ for (NETask task : tasks) {
+ threadPool.addTask(task);
+ }
+ }
+
+ public void run() {
+ while (!stopped) {
+ try {
+ Socket s = serverSocket.accept();
+ new TelnetConnection(s);
+ } catch (Exception err) {
+ err.printStackTrace();
+ try {
+ Thread.sleep(20000);
+ } catch (Exception err2) {
+ }
+ stopped = true;
+ }
+ }
+ }
+
+ public void addRootElement(Object o) {
+ NEEntry entry = new NEEntry(o);
+ elements.put(o.toString(), entry);
+
+ }
+
+ protected void processCommand(StringBuffer inputString, PrintStream sout,
+ TelnetConnection tc) {
+ if (inputString.toString().trim().equals("r")) {
+ sout.println(lastInputString);
+ inputString = lastInputString;
+ }
+ lastInputString = inputString;
+ String input = inputString.toString().trim();
+ if (input.startsWith("setExcel")) {
+ String substr = input.substring("setExcel".length()).trim();
+ if (!substr.equals("")) {
+ // excelPath01 = substr;
+ }
+ // sout.println("Excel Path="+excelPath01);
+ } else if (input.startsWith("list vrel")) {
+ String substr = input.substring("list vrel".length()).trim();
+ XSQLBluePrintNode node = bluePrint
+ .getBluePrintNodeByTableName(substr);
+ if (node == null) {
+ sout.println("Unknown Interface " + substr);
+ return;
+ }
+ List<String> fld = new ArrayList<String>();
+ for (XSQLBluePrintRelation r : node.getRelations()) {
+ fld.add(r.toString());
+ }
+ String p[] = (String[]) fld.toArray(new String[fld.size()]);
+ Arrays.sort(p);
+ for (int i = 0; i < p.length; i++) {
+ sout.println(p[i]);
+ }
+ } else if (input.startsWith("list vfields")) {
+ String substr = input.substring("list vfields".length()).trim();
+ XSQLBluePrintNode node = bluePrint
+ .getBluePrintNodeByTableName(substr);
+ if (node == null) {
+ sout.println("Unknown Interface " + substr);
+ return;
+ }
+ List<String> fld = new ArrayList<String>();
+ for (XSQLColumn c : node.getColumns()) {
+ fld.add(c.getName());
+ }
+ String p[] = (String[]) fld.toArray(new String[fld.size()]);
+ Arrays.sort(p);
+ for (int i = 0; i < p.length; i++) {
+ sout.println(p[i]);
+ }
+ } else if (input.startsWith("jdbc")) {
+ String addr = input.substring(5).trim();
+ jdbcServer.connectToClient(addr);
+ sout.println("Connected To " + addr);
+ } else if (input.startsWith("fetch")) {
+ // fetchSize = Integer.parseInt(input.substring(6).trim());
+ } else if (input.startsWith("list vtables")) {
+
+ String iNames[] = bluePrint.getAllTableNames().toArray(
+ new String[0]);
+ Arrays.sort(iNames);
+ sout.println();
+ for (int i = 0; i < iNames.length; i++) {
+ sout.println(iNames[i]);
+ }
+ } else if (input.startsWith("cd sid")) {
+ String substr = input.substring("cd sid".length()).trim();
+ for (NEEntry e : elements.values()) {
+ if (((Module) e.ne).getName().equals(substr)) {
+ tc.currentModule = (Module) e.ne;
+ }
+ }
+ } else if (input.equals("list sid")) {
+ String arr[] = new String[elements.size()];
+
+ int i = 0;
+ for (NEEntry entry : elements.values()) {
+ arr[i] = entry.toString();
+ i++;
+ }
+ Arrays.sort(arr);
+ for (String s : arr) {
+ sout.println(s);
+ }
+ } else if (input.equals("help") || input.equals("?")) {
+ // sout.println(getLongDescription());
+ } else if (input.equals("avmdata")) {
+ try {
+ // myConnection.getManagedData();
+ } catch (Exception err) {
+ }
+ } else if (input.equals("innerjoin")) {
+ // innerJoin = !innerJoin;
+ // sout.println("Inner Join set to "+innerJoin);
+ } else if (input.equals("exit")) {
+ try {
+ sout.close();
+ } catch (Exception err) {
+ }
+ } else if (input.equals("tocsv")) {
+ toCsv = !toCsv;
+ sout.println("to csv file is " + toCsv);
+ } else if (input.indexOf("filename") != -1) {
+ exportToFileName = input.substring(input.indexOf(" ")).trim();
+ sout.println("Exporting to file:" + exportToFileName);
+ } else if (!input.equals("")) {
+ if (toCsv) {
+ if (exportToFileName != null) {
+ try {
+ PrintStream o = new PrintStream(new File(
+ exportToFileName));
+ executeSql(inputString.toString(), o);
+ o.close();
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ } else {
+ try {
+ String fName = "export-" + System.currentTimeMillis()
+ + ".csv";
+ PrintStream o = new PrintStream(new File(fName));
+ executeSql(inputString.toString(), o);
+ o.close();
+ sout.println("Exported to file " + fName);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ }
+ } else {
+ executeSql(inputString.toString(), sout);
+ }
+ }
+ sout.println();
+ }
+
+ public void executeSql(String sql, PrintStream out) {
+ JDBCResultSet rs = new JDBCResultSet(sql);
+ try {
+ int count = 0;
+ jdbcServer.execute(rs, this);
+ boolean isFirst = true;
+ int loc = rs.getFields().size() - 1;
+ int totalWidth = 0;
+ for (XSQLColumn c : rs.getFields()) {
+ if (isFirst) {
+ isFirst = false;
+ if (toCsv) {
+ out.print("\"");
+ }
+ }
+
+ if (!toCsv) {
+ out.print("|");
+ }
+
+ out.print(c.getName());
+
+ if (!toCsv) {
+ int cw = c.getCharWidth();
+ int cnw = c.getName().length();
+ if (cnw > cw) {
+ c.setCharWidth(cnw);
+ }
+ int gap = cw - cnw;
+ for (int i = 0; i < gap; i++) {
+ out.print(" ");
+ }
+ }
+
+ totalWidth += c.getCharWidth() + 1;
+
+ if (loc > 0) {
+ if (toCsv) {
+ out.print("\",\"");
+ }
+ }
+ loc--;
+ }
+
+ if (toCsv) {
+ out.println("\"");
+ } else {
+ totalWidth++;
+ out.println("|");
+ for (int i = 0; i < totalWidth; i++) {
+ out.print("-");
+ }
+ out.println();
+ }
+
+ while (rs.next()) {
+ isFirst = true;
+ loc = rs.getFields().size() - 1;
+ for (XSQLColumn c : rs.getFields()) {
+ if (isFirst) {
+ isFirst = false;
+ if (toCsv) {
+ out.print("\"");
+ }
+ }
+
+ if (!toCsv) {
+ out.print("|");
+ }
+
+ Object sValue = rs.getObject(c.toString());
+ if (sValue == null) {
+ sValue = "";
+ }
+ out.print(sValue);
+
+ int cw = c.getCharWidth();
+ int vw = sValue.toString().length();
+ int gap = cw - vw;
+ for (int i = 0; i < gap; i++) {
+ out.print(" ");
+ }
+
+ if (loc > 0) {
+ if (toCsv) {
+ out.print("\",\"");
+ }
+ }
+ loc--;
+ }
+ if (toCsv) {
+ out.println("\"");
+ } else {
+ out.println("|");
+ }
+ count++;
+ }
+ out.println("Total Number Of Records=" + count);
+ } catch (Exception err) {
+ err.printStackTrace(out);
+ }
+ }
+
+ public static class NETask implements Runnable {
+
+ private JDBCResultSet rs = null;
+ private Object modelRoot = null;
+ private XSQLBluePrintNode main = null;
+ private XSQLBluePrint bluePrint = null;
+
+ public NETask(JDBCResultSet _rs, Object _modelRoot,
+ XSQLBluePrintNode _main, XSQLBluePrint _bluePrint) {
+ this.rs = _rs;
+ this.modelRoot = _modelRoot;
+ this.main = _main;
+ this.bluePrint = _bluePrint;
+ }
+
+ public void run() {
+ rs.addRecords(modelRoot, main, true, main.getBluePrintNodeName(),
+ bluePrint);
+ synchronized (rs) {
+ rs.numberOfTasks--;
+ if (rs.numberOfTasks == 0) {
+ rs.setFinished(true);
+ rs.notifyAll();
+ }
+ }
+ }
+ }
+
+ private static class NEEntry {
+ private Object ne = null;
+
+ public NEEntry(Object _ne) {
+ this.ne = _ne;
+ }
+
+ public String toString() {
+ Module m = (Module) ne;
+ return m.getName() + " [" + m.getNamespace().toString() + "]";
+ }
+ }
+
+ private class TelnetConnection extends Thread {
+
+ private Socket socket = null;
+ private InputStream in = null;
+ private PrintStream out = null;
+ private Module currentModule = null;
+
+ public TelnetConnection(Socket s) {
+ this.socket = s;
+ try {
+ this.in = s.getInputStream();
+ this.out = new PrintStream(s.getOutputStream());
+ this.start();
+ } catch (Exception err) {
+ XSQLAdapter.log(err);
+ }
+ }
+
+ public void run() {
+ StringBuffer inputString = new StringBuffer();
+ String prompt = "XSQL>";
+ try {
+ while (!stopped) {
+ if (currentModule != null) {
+ prompt = "XQL/" + currentModule.getName() + ">";
+ }
+ out.print(prompt);
+ char c = 0;
+ byte data[] = new byte[1];
+ while (c != '\n') {
+ try {
+ in.read(data);
+ c = (char) data[0];
+ inputString.append(c);
+ } catch (Exception err) {
+ err.printStackTrace(out);
+ }
+ }
+
+ processCommand(inputString, out, this);
+ inputString = new StringBuffer();
+ }
+ } catch (Exception err) {
+ try {
+ socket.close();
+ } catch (Exception err2) {
+ }
+ }
+ }
+ }
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.RowIdLifetime;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class XSQLBluePrint implements DatabaseMetaData {
+
+ public static final String CACHE_FILE_NAME = "BluePrintCache.dat";
+
+ private Map<String, XSQLBluePrintNode> tableNameToBluePrint = new HashMap<String, XSQLBluePrintNode>();
+ private Map<String, Map<String,XSQLBluePrintNode>> odlNameToBluePrint = new HashMap<String, Map<String,XSQLBluePrintNode>>();
+
+ private boolean cacheLoadedSuccessfuly = false;
+ private DatabaseMetaData myProxy = null;
+
+ public static final String replaceAll(String source, String toReplace,
+ String withThis) {
+ int index = source.indexOf(toReplace);
+ int index2 = 0;
+ StringBuffer result = new StringBuffer();
+ while (index != -1) {
+ result.append(source.substring(index2, index));
+ result.append(withThis);
+ index2 = index + toReplace.length();
+ index = source.indexOf(toReplace, index2);
+ }
+ if (index2 < source.length()) {
+ result.append(source.substring(index2));
+ }
+ return result.toString();
+ }
+
+ public XSQLBluePrint() {
+ }
+
+ private class NQLBluePrintProxy implements InvocationHandler {
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ System.out.println("Method " + method);
+ return method.invoke(XSQLBluePrint.this, args);
+ }
+ }
+
+ public DatabaseMetaData getProxy() {
+ if (myProxy == null) {
+ try {
+ myProxy = (DatabaseMetaData) Proxy
+ .newProxyInstance(getClass().getClassLoader(),
+ new Class[] {DatabaseMetaData.class},
+ new NQLBluePrintProxy());
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+ return myProxy;
+ }
+
+ /*
+ public void loadBluePrintCache(String hostName) {
+ try {
+ ObjectInputStream in = new ObjectInputStream(
+ new FileInputStream(hostName + "-" + CACHE_FILE_NAME));
+ cache = (Map) in.readObject();
+ in.close();
+ cacheLoadedSuccessfuly = true;
+ } catch (Exception err) {
+ //err.printStackTrace();
+ }
+ }*/
+
+ public XSQLBluePrintNode[] getBluePrintNodeByODLTableName(String odlTableName) {
+ Map<String,XSQLBluePrintNode> map = this.odlNameToBluePrint.get(odlTableName);
+ if(map==null) return null;
+ return map.values().toArray(new XSQLBluePrintNode[map.size()]);
+ }
+
+ public XSQLBluePrintNode getBluePrintNodeByTableName(String tableName) {
+ if (tableName.indexOf(".") != -1) {
+ tableName = tableName.substring(tableName.lastIndexOf(".") + 1);
+ }
+
+ XSQLBluePrintNode node = tableNameToBluePrint.get(tableName);
+
+ if (node != null) {
+ return node;
+ }
+
+ for (XSQLBluePrintNode n : tableNameToBluePrint.values()) {
+ if (n.getBluePrintNodeName().endsWith(tableName)) {
+ return n;
+ }
+ }
+
+ for (XSQLBluePrintNode n : tableNameToBluePrint.values()) {
+ if (n.getBluePrintNodeName().toLowerCase().endsWith(tableName.toLowerCase())) {
+ return n;
+ }
+ }
+
+ for (XSQLBluePrintNode n : tableNameToBluePrint.values()) {
+ if (n.getBluePrintNodeName().toLowerCase().equals(tableName.toLowerCase())) {
+ return n;
+ }
+ }
+
+ for (XSQLBluePrintNode n : tableNameToBluePrint.values()) {
+ if (n.getBluePrintNodeName().toLowerCase().indexOf(tableName.toLowerCase())!= -1) {
+ return n;
+ }
+ }
+ return null;
+ }
+
+
+ public boolean isCacheLoaded() {
+ return cacheLoadedSuccessfuly;
+ }
+
+ private static Map<Class, Set<Class>> superClassMap = new HashMap<Class, Set<Class>>();
+
+ public static Set<Class> getInheritance(Class myObjectClass,
+ Class returnType) {
+
+ if (returnType != null && myObjectClass.equals(returnType)) {
+ return new HashSet<Class>();
+ }
+ Set<Class> result = superClassMap.get(myObjectClass);
+ if (result != null) {
+ return result;
+ }
+ result = new HashSet<Class>();
+ superClassMap.put(myObjectClass, result);
+ if (returnType != null) {
+ if (!returnType.equals(myObjectClass)) {
+ Class mySuperClass = myObjectClass.getSuperclass();
+ while (mySuperClass != null) {
+ result.add(mySuperClass);
+ mySuperClass = mySuperClass.getSuperclass();
+ }
+ result.addAll(collectInterfaces(myObjectClass));
+ }
+ }
+ return result;
+ }
+
+ public static Set<Class> collectInterfaces(Class cls) {
+ Set<Class> result = new HashSet();
+ Class myInterfaces[] = cls.getInterfaces();
+ if (myInterfaces != null) {
+ for (Class in : myInterfaces) {
+ result.add(in);
+ result.addAll(collectInterfaces(in));
+ }
+ }
+ return result;
+ }
+
+ public void addToBluePrintCache(XSQLBluePrintNode blNode) {
+ this.tableNameToBluePrint.put(blNode.getBluePrintNodeName(), blNode);
+ Map<String,XSQLBluePrintNode> map = this.odlNameToBluePrint.get(blNode.getODLTableName());
+ if(map==null){
+ map = new HashMap<String,XSQLBluePrintNode>();
+ this.odlNameToBluePrint.put(blNode.getODLTableName(),map);
+ }
+ map.put(blNode.getBluePrintNodeName(), blNode);
+ }
+
+ public Class getGenericType(ParameterizedType type) {
+ Type[] typeArguments = type.getActualTypeArguments();
+ for (Type typeArgument : typeArguments) {
+ if (typeArgument instanceof ParameterizedType) {
+ ParameterizedType pType = (ParameterizedType) typeArgument;
+ return (Class) pType.getRawType();
+ } else if (typeArgument instanceof Class) {
+ return (Class) typeArgument;
+ }
+ }
+ return null;
+ }
+
+ public Class getMethodReturnTypeFromGeneric(Method m) {
+ Type rType = m.getGenericReturnType();
+ if (rType instanceof ParameterizedType) {
+ return getGenericType((ParameterizedType) rType);
+ }
+ return null;
+ }
+
+ public List<String> getAllTableNames() {
+ List<String> names = new ArrayList<String>();
+ for (XSQLBluePrintNode n : this.tableNameToBluePrint.values()) {
+ if (!n.isModule() && !n.getColumns().isEmpty()) {
+ names.add(n.getBluePrintNodeName());
+ }
+ }
+ return names;
+
+ }
+
+ public List<String> getInterfaceNames(XSQLBluePrintNode node) {
+ Set<XSQLBluePrintNode> children = node.getChildren();
+ List<String> names = new ArrayList<String>();
+ for (XSQLBluePrintNode n : children) {
+ if (!n.isModule() && !n.getColumns().isEmpty()) {
+ names.add(n.toString());
+ }
+ names.addAll(getInterfaceNames(n));
+ }
+ return names;
+ }
+
+ @Override
+ public boolean allProceduresAreCallable() throws SQLException {
+ return false;
+ }
+
+ @Override
+ public boolean allTablesAreSelectable() throws SQLException {
+ return true;
+ }
+
+ @Override
+ public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean deletesAreDetected(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public ResultSet getAttributes(String catalog, String schemaPattern,
+ String typeNamePattern, String attributeNamePattern)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getBestRowIdentifier(String catalog, String schema,
+ String table, int scope, boolean nullable) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getCatalogs() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getCatalogSeparator() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getCatalogTerm() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getClientInfoProperties() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getColumnPrivileges(String catalog, String schema,
+ String table, String columnNamePattern) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getColumns(String catalog, String schemaPattern,
+ String tableNamePattern, String columnNamePattern)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Connection getConnection() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getCrossReference(String parentCatalog,
+ String parentSchema, String parentTable, String foreignCatalog,
+ String foreignSchema, String foreignTable) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getDatabaseMajorVersion() throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public int getDatabaseMinorVersion() throws SQLException {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ @Override
+ public String getDatabaseProductName() throws SQLException {
+ return "VNE Query Language";
+ }
+
+ @Override
+ public String getDatabaseProductVersion() throws SQLException {
+ return "0.1";
+ }
+
+ @Override
+ public int getDefaultTransactionIsolation() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getDriverMajorVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getDriverMinorVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getDriverName() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getDriverVersion() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getExportedKeys(String catalog, String schema,
+ String table)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getExtraNameCharacters() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getFunctionColumns(String catalog, String schemaPattern,
+ String functionNamePattern, String columnNamePattern)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getFunctions(String catalog, String schemaPattern,
+ String functionNamePattern) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getIdentifierQuoteString() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getImportedKeys(String catalog, String schema,
+ String table)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getIndexInfo(String catalog, String schema, String table,
+ boolean unique, boolean approximate) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getJDBCMajorVersion() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getJDBCMinorVersion() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxBinaryLiteralLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxCatalogNameLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxCharLiteralLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxColumnNameLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxColumnsInGroupBy() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxColumnsInIndex() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxColumnsInOrderBy() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxColumnsInSelect() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxColumnsInTable() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxConnections() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxCursorNameLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxIndexLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxProcedureNameLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxRowSize() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxSchemaNameLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxStatementLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxStatements() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxTableNameLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxTablesInSelect() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxUserNameLength() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getNumericFunctions() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getPrimaryKeys(String catalog, String schema, String table)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getProcedureColumns(String catalog, String schemaPattern,
+ String procedureNamePattern, String columnNamePattern)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getProcedures(String catalog, String schemaPattern,
+ String procedureNamePattern) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getProcedureTerm() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getResultSetHoldability() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public RowIdLifetime getRowIdLifetime() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getSchemas() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getSchemas(String catalog, String schemaPattern)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getSchemaTerm() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getSearchStringEscape() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getSQLKeywords() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getSQLStateType() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getStringFunctions() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getSuperTables(String catalog, String schemaPattern,
+ String tableNamePattern) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getSuperTypes(String catalog, String schemaPattern,
+ String typeNamePattern) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getSystemFunctions() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getTablePrivileges(String catalog, String schemaPattern,
+ String tableNamePattern) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getTables(String catalog, String schemaPattern,
+ String tableNamePattern, String[] types) throws SQLException {
+ return new TablesResultSet(this);
+ }
+
+ @Override
+ public ResultSet getTableTypes() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getTimeDateFunctions() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getTypeInfo() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getUDTs(String catalog, String schemaPattern,
+ String typeNamePattern, int[] types) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getURL() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getUserName() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getVersionColumns(String catalog, String schema,
+ String table) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean insertsAreDetected(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isCatalogAtStart() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isReadOnly() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean locatorsUpdateCopy() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean nullPlusNonNullIsNull() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean nullsAreSortedAtEnd() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean nullsAreSortedAtStart() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean nullsAreSortedHigh() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean nullsAreSortedLow() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean othersDeletesAreVisible(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean othersInsertsAreVisible(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean othersUpdatesAreVisible(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean ownDeletesAreVisible(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean ownInsertsAreVisible(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean ownUpdatesAreVisible(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean storesLowerCaseIdentifiers() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean storesMixedCaseIdentifiers() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean storesUpperCaseIdentifiers() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsAlterTableWithAddColumn() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsAlterTableWithDropColumn() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsANSI92FullSQL() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsANSI92IntermediateSQL() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsBatchUpdates() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsCatalogsInDataManipulation() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsCatalogsInPrivilegeDefinitions()
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsColumnAliasing() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsConvert() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsConvert(int fromType, int toType)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsCoreSQLGrammar() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsCorrelatedSubqueries() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsDataDefinitionAndDataManipulationTransactions()
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsDataManipulationTransactionsOnly()
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsDifferentTableCorrelationNames()
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsExpressionsInOrderBy() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsExtendedSQLGrammar() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsFullOuterJoins() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsGetGeneratedKeys() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsGroupBy() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsGroupByBeyondSelect() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsGroupByUnrelated() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsLikeEscapeClause() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsLimitedOuterJoins() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsMinimumSQLGrammar() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsMixedCaseIdentifiers() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsMultipleOpenResults() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsMultipleResultSets() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsMultipleTransactions() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsNamedParameters() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsNonNullableColumns() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsOrderByUnrelated() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsOuterJoins() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsPositionedDelete() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsPositionedUpdate() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsResultSetConcurrency(int type, int concurrency)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsResultSetHoldability(int holdability)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsResultSetType(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSavepoints() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSchemasInDataManipulation() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSchemasInProcedureCalls() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSchemasInTableDefinitions() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSelectForUpdate() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsStatementPooling() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsStoredFunctionsUsingCallSyntax()
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsStoredProcedures() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSubqueriesInComparisons() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSubqueriesInExists() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSubqueriesInIns() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsTableCorrelationNames() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsTransactionIsolationLevel(int level)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsTransactions() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsUnion() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean supportsUnionAll() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean updatesAreDetected(int type) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean usesLocalFilePerTable() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean usesLocalFiles() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ResultSet getPseudoColumns(String catalog, String schemaPattern,
+ String tableNamePattern, String columnNamePattern)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean generatedKeyAlwaysReturned() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.Serializable;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+public class XSQLBluePrintNode implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private Class<?> myInterface = null;
+ private String myInterfaceString = null;
+ private Set<XSQLBluePrintRelation> relations =
+ new HashSet<XSQLBluePrintRelation>();
+ private Set<XSQLBluePrintNode> inheritingNodes =
+ new HashSet<XSQLBluePrintNode>();
+ private Set<XSQLBluePrintNode> children = new HashSet<XSQLBluePrintNode>();
+ private XSQLBluePrintNode parent = null;
+
+ private int level = -1;
+ private transient Set<String> parentHierarchySet = null;
+ private String myInterfaceName = null;
+ private Set<XSQLColumn> columns = new HashSet<XSQLColumn>();
+
+ private transient Object odlNode = null;
+ private boolean module = false;
+ private String bluePrintTableName = null;
+ private String odlTableName = null;
+
+ public XSQLBluePrintNode(Class<?> _myInterface, int _level) {
+ this.myInterface = _myInterface;
+ this.myInterfaceString = _myInterface.getName();
+ this.myInterfaceName = myInterface.getSimpleName();
+ this.level = _level;
+ }
+
+ public XSQLBluePrintNode(Object _odlNode, int _level,XSQLBluePrintNode _parent) {
+ this.odlNode = _odlNode;
+ this.level = _level;
+ this.module = XSQLODLUtils.isModule(_odlNode);
+ this.parent = _parent;
+ this.bluePrintTableName = XSQLODLUtils.getBluePrintName(_odlNode);
+
+ }
+
+ public String getBluePrintNodeName(){
+ return this.bluePrintTableName;
+ }
+
+ public boolean isModule() {
+ return this.module;
+ }
+
+ public Set<XSQLBluePrintNode> getChildren() {
+ return this.children;
+ }
+
+ public String getODLTableName() {
+ if (this.odlTableName == null) {
+ this.odlTableName = XSQLODLUtils.getODLNodeName(this.odlNode);
+ }
+ return this.odlTableName;
+ }
+
+ public Object getODLNode() {
+ return this.odlNode;
+ }
+
+ public void AddChild(XSQLBluePrintNode ch) {
+ this.children.add(ch);
+ }
+
+ public boolean isModelChild(Class p) {
+ if (this.relations.size() == 0) {
+ return false;
+ }
+ for (XSQLBluePrintRelation parentRelation : this.relations) {
+ if (parentRelation.getParent().getInterface().equals(p)) {
+ return true;
+ }
+ }
+ for (XSQLBluePrintRelation dtr : this.relations) {
+ XSQLBluePrintNode parent = dtr.getParent();
+ if (!parent.getInterface().equals(this.getInterface()) && !parent
+ .getInterface().isAssignableFrom(this.getInterface()) &&
+ this.getInterface().isAssignableFrom(parent.getInterface())
+ && parent.isModelChild(p)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Set<XSQLBluePrintRelation> getRelations() {
+ return this.relations;
+ }
+
+ public String getClassName() {
+ return this.myInterfaceString;
+ }
+
+ public void addInheritingNode(XSQLBluePrintNode node) {
+ this.inheritingNodes.add(node);
+ }
+
+ public Set<XSQLBluePrintNode> getInheritingNodes() {
+ return this.inheritingNodes;
+ }
+
+ public void addColumn(Object node, String tableName) {
+ XSQLColumn c = new XSQLColumn(node,getBluePrintNodeName(), this);
+ this.columns.add(c);
+ }
+
+ public void addColumn(String methodName) {
+ if (methodName.startsWith("get")) {
+ methodName = methodName.substring(3);
+ } else if (methodName.startsWith("is")) {
+ methodName = methodName.substring(2);
+ }
+ XSQLColumn c = new XSQLColumn(methodName, myInterfaceName, null);
+ this.columns.add(c);
+ }
+
+ public Collection<XSQLColumn> getColumns() {
+ return this.columns;
+ }
+
+ public XSQLColumn findColumnByName(String name) throws SQLException {
+
+ XSQLColumn exactMatch = null;
+ XSQLColumn indexOfMatch = null;
+ XSQLColumn exactLowercaseMatch = null;
+ XSQLColumn indexOfLowerCaseMatch = null;
+
+ for (XSQLColumn col : columns) {
+ if (col.getName().equals(name)) {
+ exactMatch = col;
+ }
+ if (col.getName().indexOf(name) != -1) {
+ indexOfMatch = col;
+ }
+ if (col.getName().toLowerCase().equals(name.toLowerCase())) {
+ exactLowercaseMatch = col;
+ }
+ if (col.getName().toLowerCase().indexOf(name.toLowerCase()) != -1) {
+ indexOfLowerCaseMatch = col;
+ }
+ }
+
+ if (exactMatch != null) {
+ return exactMatch;
+ }
+ if (exactLowercaseMatch != null) {
+ return exactLowercaseMatch;
+ }
+ if (indexOfMatch != null) {
+ return indexOfMatch;
+ }
+ if (indexOfLowerCaseMatch != null) {
+ return indexOfLowerCaseMatch;
+ }
+
+ throw new SQLException("Unknown field name '" + name + "'");
+ }
+
+
+ public void addParent(XSQLBluePrintNode parent, String property) {
+ try {
+ if (property.equals("ContainingTPs")) {
+ return;
+ }
+ //Method m = parent.getInterface().getMethod("get"+property, null);
+ //if(!m.getDeclaringClass().equals(parent.getInterface()))
+ //return;
+ XSQLBluePrintRelation rel =
+ new XSQLBluePrintRelation(parent, property, myInterface);
+ relations.add(rel);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ public XSQLBluePrintNode getParent() {
+ return this.parent;
+ }
+
+ public Set<XSQLBluePrintRelation> getClonedParents() {
+ Set<XSQLBluePrintRelation> result =
+ new HashSet<XSQLBluePrintRelation>();
+ result.addAll(this.relations);
+ return result;
+ }
+
+ public String toString() {
+ if (myInterfaceName != null) {
+ return myInterfaceName;
+ }
+ if (odlNode != null) {
+ return getBluePrintNodeName();
+ }
+ return "Unknown";
+ }
+
+ public Class getInterface() {
+ return this.myInterface;
+ }
+
+ public int getLevel() {
+ return this.level;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ XSQLBluePrintNode other = (XSQLBluePrintNode) obj;
+ if (odlNode != null) {
+ return getBluePrintNodeName().equals(other.getBluePrintNodeName());
+ } else if (this.odlTableName != null) {
+ return this.odlTableName.equals(other.odlTableName);
+ } else {
+ return other.myInterface.equals(myInterface);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ if (myInterfaceString != null) {
+ return myInterfaceString.hashCode();
+ } else if (odlNode != null) {
+ return bluePrintTableName.hashCode();
+ }
+ return 0;
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class XSQLBluePrintRelation implements Serializable {
+ private static final long serialVersionUID = 2L;
+ private XSQLBluePrintNode parent = null;
+ private String property = null;
+ private Class<?> childClass = null;
+
+ public XSQLBluePrintRelation(XSQLBluePrintNode _parent, String _property,
+ Class<?> _childClass) {
+ this.parent = _parent;
+ this.property = _property;
+ this.childClass = _childClass;
+ }
+
+ public Class<?> getNEClosestClass() {
+ Class<?> p = parent.getInterface();
+ return getNEClosestClass(p);
+ }
+
+
+ public static Class<?> getNEClosestClass(Class<?> p) {
+ while (!p.getInterfaces()[0]
+ .equals(Object.class/*XSQLBluePrint.STOP_INTERFACE*/)) {
+ p = p.getInterfaces()[0];
+ }
+ return p;
+ }
+
+ public XSQLBluePrintNode getParent() {
+ return parent;
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public Class<?> getChildClass() {
+ return this.childClass;
+ }
+
+ public boolean equals(Object obj) {
+ XSQLBluePrintRelation other = (XSQLBluePrintRelation) obj;
+ if (other.parent != null && this.parent == null) {
+ return false;
+ }
+ if (other.parent == null && this.parent != null) {
+ return false;
+ }
+
+ if (other.parent == null && this.parent == null) {
+ return property.equals(other.property);
+ }
+
+ if (other.parent.toString().equals(this.parent.toString())) {
+ return property.equals(other.property);
+ }
+
+ return false;
+ }
+
+ public int hashCode() {
+ if (parent != null) {
+ return parent.toString().hashCode() + property.hashCode();
+ }
+ return property.hashCode();
+ }
+
+ public String toString() {
+ if (parent != null) {
+ return parent.toString() + ":" + property;
+ } else {
+ return property;
+ }
+ }
+
+ public List execute(Object o) {
+ List result = new LinkedList();
+ if (o == null) {
+ return null;
+ }
+
+ if (Set.class.isAssignableFrom(o.getClass())) {
+ Set lst = (Set) o;
+ for (Object oo : lst) {
+ addToResult(result, execute(oo));
+ }
+ return result;
+ } else if (List.class.isAssignableFrom(o.getClass())) {
+ List lst = (List) o;
+ for (Object oo : lst) {
+ addToResult(result, execute(oo));
+ }
+ return result;
+ } else if (Map.class.isAssignableFrom(o.getClass())) {
+ Map map = (Map) o;
+ for (Object oo : map.values()) {
+ addToResult(result, execute(oo));
+ }
+ return result;
+ }
+
+ addToResult(result, XSQLCriteria.getValue(o, this.property));
+
+ return result;
+ }
+
+ public static void addToResult(List result, Object o) {
+ if (o == null) {
+ return;
+ }
+ if (Set.class.isAssignableFrom(o.getClass())) {
+ Set lst = (Set) o;
+ for (Object oo : lst) {
+ result.add(oo);
+ }
+ } else if (List.class.isAssignableFrom(o.getClass())) {
+ List lst = (List) o;
+ for (Object oo : lst) {
+ result.add(oo);
+ }
+ } else if (Map.class.isAssignableFrom(o.getClass())) {
+ Map map = (Map) o;
+ for (Object oo : map.values()) {
+ result.add(oo);
+ }
+ } else {
+ result.add(o);
+ }
+ }
+
+}
+
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.Serializable;
+
+public class XSQLColumn implements Serializable, Comparable {
+ private String name = null;
+ private String tableName = null;
+ private int charWidth = -1;
+ private Class type = null;
+ private transient Object bluePrintNode = null;
+
+ public XSQLColumn(Object odlNode, String _tableName, Object _bluePrintNode) {
+ this.name = XSQLODLUtils.getNodeNameFromDSN(odlNode);
+ this.tableName = _tableName;
+ this.bluePrintNode = _bluePrintNode;
+ this.type = XSQLODLUtils.getTypeForODLColumn(odlNode);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getTableName() {
+ return tableName;
+ }
+
+ public void setCharWidth(int i) {
+ if (this.charWidth < i) {
+ this.charWidth = i;
+ }
+ }
+
+ public int getCharWidth() {
+ return this.charWidth;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.name.hashCode() + this.tableName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof XSQLColumn)) {
+ return false;
+ }
+ XSQLColumn other = (XSQLColumn) obj;
+ return tableName.equals(other.tableName) && name.equals(other.name);
+ }
+
+ public Object getBluePrintNode() {
+ return this.bluePrintNode;
+ }
+
+ @Override
+ public String toString() {
+ return tableName + "." + name;
+ }
+
+ @Override
+ public int compareTo(Object o) {
+ return this.toString().compareTo(o.toString());
+ }
+
+ public Object getResultSetValue(Object obj){
+ if(this.type.equals(String.class)){
+ return obj.toString();
+ }else
+ if(this.type.equals(int.class)){
+ return Integer.parseInt(obj.toString());
+ }else
+ if(this.type.equals(long.class)){
+ return Long.parseLong(obj.toString());
+ }else
+ if(this.type.equals(byte.class)){
+ return Byte.parseByte(obj.toString());
+ }
+ return null;
+ }
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class XSQLCriteria implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static final String operators[] =
+ new String[] {" and ", " or ", ">=", "<=", "!=", "=", ">", "<", "like",
+ "is null", "not null", "skip"};
+ private static final String STRING_CHAR = "'";
+
+ public static final int OP_CODE_AND = 0;
+ public static final int OP_CODE_OR = 1;
+ public static final int OP_CODE_GTEQ = 2;
+ public static final int OP_CODE_LTEQ = 3;
+ public static final int OP_CODE_NOT_EQ = 4;
+ public static final int OP_CODE_EQUAL = 5;
+ public static final int OP_CODE_GT = 6;
+ public static final int OP_CODE_LT = 7;
+ public static final int OP_CODE_LIKE = 8;
+ public static final int OP_CODE_NULL = 9;
+ public static final int OP_CODE_NOT_NULL = 10;
+ public static final int OP_CODE_SKIP = 11;
+
+ private XSQLCriteria left = null;
+ private XSQLCriteria right = null;
+
+ private int operation = -1;
+
+ private Object leftValue = null;
+ private Object rightValue = null;
+ private String criteria = null;
+
+ private static final Map<Class<?>, Map<String, Method>> methodCache =
+ new ConcurrentHashMap<Class<?>, Map<String, Method>>();
+
+ public XSQLCriteria(final String data, final int parentOperation) {
+ criteria = data;
+ parse(data, parentOperation);
+ }
+
+ private void parse(String data, int parentOperation) {
+
+ data = data.trim();
+
+ int index1 = data.indexOf("(");
+ if (index1 != -1) {
+ String leftCondition = data.substring(0, index1).trim();
+ if (leftCondition.trim().equals("")) {
+ int index2 = data.lastIndexOf(")");
+ if (index2 < data.length() - 1) {
+ String rtValue = data.substring(index2 + 1).trim();
+ if (!rtValue.equals("")) {
+ left =
+ new XSQLCriteria(data.substring(index1 + 1, index2),
+ parentOperation);
+ data = data.substring(index2 + 1);
+ } else {
+ data = data.substring(1, index2);
+ }
+ } else {
+ data = data.substring(1, index2);
+ }
+ } else {
+ right = new XSQLCriteria(
+ data.substring(index1 + 1, data.length() - 1),
+ parentOperation);
+ data = data.substring(0, index1);
+ }
+ }
+
+ for (int i = 0; i < operators.length; i++) {
+ index1 = data.indexOf(operators[i]);
+ if (index1 != -1) {
+ this.operation = i;
+ if (left == null) {
+ left = new XSQLCriteria(data.substring(0, index1),
+ this.operation);
+ }
+ if (left.leftValue != null && left.rightValue == null
+ && left.right == null) {
+ leftValue = left.leftValue;
+ left = null;
+ }
+ if (right == null) {
+ right = new XSQLCriteria(
+ data.substring(index1 + operators[i].length()),
+ this.operation);
+ }
+ if (right.leftValue != null && right.rightValue == null
+ && right.right == null) {
+ rightValue = right.leftValue;
+ right = null;
+ }
+ return;
+ }
+ }
+
+ if (data.startsWith("'") && data.endsWith("'")) {
+ data = data.substring(1, data.length() - 1);
+ }
+
+ if (parentOperation == OP_CODE_LIKE && data.startsWith("%") && data.endsWith("%")
+ && data.substring(1, data.length() - 1).indexOf("%") == -1) {
+ data = data.substring(1, data.length() - 1);
+ }
+
+ leftValue = data;
+ }
+
+ public static Object getValue(Object element, String propertyName) {
+ try {
+ Map<String, Method> cache = methodCache.get(element.getClass());
+ if (cache == null) {
+ cache = new ConcurrentHashMap<String, Method>();
+ methodCache.put(element.getClass(), cache);
+ }
+
+ Method m = cache.get(propertyName);
+ if (m == null) {
+ Method methods[] = element.getClass().getMethods();
+ for (Method mm : methods) {
+ if (mm.getName().equals(propertyName) || mm.getName()
+ .equals("get" + propertyName) || mm.getName()
+ .equals("is" + propertyName)) {
+ m = mm;
+ m.setAccessible(true);
+ cache.put(propertyName, m);
+ break;
+ }
+ }
+ }
+
+ Object value = null;
+ if (m == null) {
+ return null;
+ }
+ if (m.getParameterTypes() == null
+ || m.getParameterTypes().length == 0) {
+ value = m.invoke(element, null);
+ } else {
+ if (String.class.isAssignableFrom(m.getParameterTypes()[0])) {
+ return null;
+ }
+ Object arg = m.getParameterTypes()[0].newInstance();
+ value = m.invoke(element, arg);
+ }
+ return value;
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ return null;
+ }
+
+ public int isObjectFitCriteria(Object element, String propertyName) {
+ Object value = getValue(element, propertyName);
+ if (value != null) {
+ value = value.toString();
+ }
+ return checkValue(value);
+ }
+
+ public int checkValue(Object value) {
+ if (leftValue != null && rightValue != null) {
+ Object aSide = null;
+ Object bSide = null;
+ if (leftValue.equals("?")) {
+ aSide = value;
+ } else {
+ aSide = leftValue;
+ }
+
+ if (rightValue.equals("?")) {
+ bSide = value;
+ } else {
+ bSide = rightValue;
+ }
+ if (operation != OP_CODE_SKIP && operation != OP_CODE_NULL) {
+ if (aSide == null && bSide != null) {
+ return 0;
+ } else if (aSide != null && bSide == null) {
+ return 0;
+ } else if (aSide == null && bSide == null) {
+ return 1;
+ }
+ }
+ switch (operation) {
+ case OP_CODE_EQUAL:
+ if (aSide.equals(bSide)) {
+ return 1;
+ } else {
+ return 0;
+ }
+ case OP_CODE_NOT_EQ:
+ if (!aSide.equals(bSide)) {
+ return 1;
+ } else {
+ return 0;
+ }
+ case OP_CODE_LIKE:
+ if (aSide.toString().indexOf(bSide.toString()) != -1) {
+ return 1;
+ } else {
+ return 0;
+ }
+ case OP_CODE_NULL:
+ if (aSide == null) {
+ return 1;
+ } else {
+ return 0;
+ }
+ case OP_CODE_NOT_NULL:
+ if (aSide != null) {
+ return 1;
+ } else {
+ return 0;
+ }
+ case OP_CODE_GT:
+ if (aSide == null || bSide == null) {
+ return 0;
+ }
+ if (Double.parseDouble(aSide.toString().trim()) > Double
+ .parseDouble(bSide.toString().trim())) {
+ return 1;
+ } else {
+ return 0;
+ }
+ case OP_CODE_GTEQ:
+ if (aSide == null || bSide == null) {
+ return 0;
+ }
+ if (Double.parseDouble(aSide.toString().trim()) >= Double
+ .parseDouble(bSide.toString().trim())) {
+ return 1;
+ } else {
+ return 0;
+ }
+
+ case OP_CODE_LT:
+ if (aSide == null || bSide == null) {
+ return 0;
+ }
+ if (Double.parseDouble(aSide.toString().trim()) < Double
+ .parseDouble(bSide.toString().trim())) {
+ return 1;
+ } else {
+ return 0;
+ }
+ case OP_CODE_LTEQ:
+ if (aSide == null || bSide == null) {
+ return 0;
+ }
+ if (Double.parseDouble(aSide.toString().trim()) <= Double
+ .parseDouble(bSide.toString().trim())) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ }
+
+ int leftResult = 0;
+ if (left != null) {
+ leftResult = left.checkValue(value);
+ }
+
+ int rightResult = 0;
+ if (right != null) {
+ rightResult = right.checkValue(value);
+ }
+
+ if (operation == OP_CODE_SKIP) {
+ if (rightResult == 0) {
+ return 2;
+ } else {
+ return 3;
+ }
+ }
+
+ if (operation == OP_CODE_AND) {
+ if (leftResult == 0) {
+ return 0;
+ }
+ if (rightResult == 0) {
+ return 0;
+ }
+ if (leftResult >= 2) {
+ return leftResult;
+ }
+ if (rightResult >= 2) {
+ return rightResult;
+ }
+
+ return 1;
+ }
+
+ if (operation == OP_CODE_OR) {
+ if (leftResult == 0 && rightResult == 0) {
+ return 0;
+ }
+ if (leftResult >= 2) {
+ return leftResult;
+ }
+ if (rightResult >= 2) {
+ return rightResult;
+ }
+ return 1;
+ }
+
+ return 0;
+ }
+
+ public String toString() {
+ return criteria;
+ }
+
+ public String getCriteriaForProperty(XSQLColumn col) {
+ StringBuffer result = new StringBuffer();
+ if (criteria == null) {
+ return "";
+ }
+
+ if (leftValue != null && rightValue != null) {
+ if (leftValue.toString().toLowerCase().equals(col.getName().toLowerCase()) ||
+ leftValue.toString().toLowerCase().equals(col.toString().toLowerCase()) /*||
+ /*col.getName().toLowerCase().indexOf(leftValue.toString().toLowerCase()) != -1*/) {
+ result.append("? ").append(operators[operation]).append(" ").append(rightValue);
+ }else
+ if (rightValue.toString().toLowerCase().equals(col.getName().toLowerCase()) ||
+ rightValue.toString().toLowerCase().equals(col.toString().toLowerCase()) /*||
+ col.getName().toLowerCase().indexOf(rightValue.toString().toLowerCase()) != -1*/) {
+ result.append("? ").append(operators[operation]).append(" ").append(leftValue);
+ }
+ return result.toString();
+ } else if (left != null && right != null) {
+ String leftString = left.getCriteriaForProperty(col);
+ String rightString = right.getCriteriaForProperty(col);
+ if (!leftString.equals("") && !rightString.equals("")) {
+ return leftString + " " + operators[operation] + " "
+ + rightString;
+ } else if (!leftString.equals("")) {
+ return leftString;
+ } else if (!rightString.equals("")) {
+ return rightString;
+ }
+ return "";
+ } else if (leftValue != null && leftValue.toString().toLowerCase()
+ .equals(col.toString().toLowerCase()) && right != null) {
+ return "? " + operators[operation] + " (" + right
+ .getCriteriaForProperty(col) + ")";
+ } else if (rightValue != null && rightValue.toString().toLowerCase()
+ .equals(col.toString().toLowerCase()) && left != null) {
+ return "(" + left.getCriteriaForProperty(col) + ") "
+ + operators[operation] + " ?";
+ }
+ return "";
+ }
+
+ public static void main(String args[]) {
+ XSQLCriteria p =
+ new XSQLCriteria("ip like '%101%' or (354>=0 or 456>=3)", -1);
+ System.out.println(p.checkValue("192.268.4.4"));
+ p = new XSQLCriteria("? like '%267%'", -1);
+ System.out.println(p.checkValue("192.268.4.4"));
+
+ }
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.util.Uint16;
+import org.opendaylight.yangtools.yang.model.util.Uint32;
+import org.opendaylight.yangtools.yang.model.util.Uint64;
+import org.opendaylight.yangtools.yang.model.util.Uint8;
+
+public class XSQLODLUtils {
+
+ private static Map<Class<?>, Class<?>> types =
+ new ConcurrentHashMap<Class<?>, Class<?>>();
+
+ static {
+ types.put(QName.class, QName.class);
+ types.put(SchemaPath.class, SchemaPath.class);
+ types.put(Status.class, Status.class);
+ }
+
+ public static boolean isColumnType(Class cls) {
+ return types.containsKey(cls);
+ }
+
+ public static String getTableName(Object odlNode) {
+ if (odlNode instanceof Module) {
+ return ((Module) odlNode).getNamespace().toString();
+ } else if (odlNode instanceof DataSchemaNode) {
+ SchemaPath p = ((DataSchemaNode) odlNode).getPath();
+ return extractTableName(p);
+ } else {
+ int i = 0;
+ }
+ return null;
+ }
+
+ public static String extractTableName(SchemaPath path) {
+ List<QName> lst = path.getPath();
+ StringBuffer name = new StringBuffer();
+ int i = 0;
+ for (QName q : lst) {
+ name.append(q.getLocalName());
+ i++;
+ if (i < lst.size()) {
+ name.append("/");
+ }
+ }
+ return name.toString();
+ }
+
+ public static String getBluePrintName(Object odlNode){
+ if (odlNode instanceof Module) {
+ return ((Module) odlNode).getNamespace().toString();
+ } else if (odlNode instanceof DataSchemaNode) {
+ SchemaPath p = ((DataSchemaNode) odlNode).getPath();
+ return extractTableName(p);
+ }
+ return null;
+ }
+
+ public static String getODLNodeName(Object odlNode) {
+ if (odlNode instanceof Module) {
+ return ((Module) odlNode).getNamespace().toString();
+ } else if (odlNode instanceof DataSchemaNode) {
+ SchemaPath p = ((DataSchemaNode) odlNode).getPath();
+ List<QName> lst = p.getPath();
+ return lst.get(lst.size() - 1).toString();
+ }
+ return null;
+ }
+
+ public static List<QName> getPath(Object odlNode) {
+ return ((DataSchemaNode) odlNode).getPath().getPath();
+ }
+
+
+ public static String getODLTableName(Object odlNode) {
+ if (odlNode instanceof Module) {
+ return ((Module) odlNode).getNamespace().toString();
+ } else if (odlNode instanceof DataSchemaNode) {
+ return ((DataSchemaNode) odlNode).getPath().toString();
+ }
+ return null;
+ }
+
+ public static String getNodeNameFromDSN(Object o) {
+ DataSchemaNode node = (DataSchemaNode) o;
+ String nodeName = node.getQName().toString();
+ int index = nodeName.lastIndexOf(")");
+ return nodeName.substring(index + 1);
+ }
+
+ public static boolean isModule(Object o) {
+ if (o instanceof Module) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean createOpenDaylightCache(XSQLBluePrint bluePrint,Object module) {
+ XSQLBluePrintNode node = new XSQLBluePrintNode(module, 0,null);
+ bluePrint.addToBluePrintCache(node);
+ collectODL(bluePrint, node, ((Module) module).getChildNodes(), 1);
+ return true;
+ }
+
+ private static void collectODL(XSQLBluePrint bluePrint,
+ XSQLBluePrintNode parent, Collection<DataSchemaNode> nodes, int level) {
+ if (nodes == null) {
+ return;
+ }
+ for (DataSchemaNode n : nodes) {
+ if (n instanceof DataNodeContainer /*|| n instanceof LeafListSchemaNode*/
+ || n instanceof ListSchemaNode) {
+ XSQLBluePrintNode bn = new XSQLBluePrintNode(n, level,parent);
+ bluePrint.addToBluePrintCache(bn);
+ parent.AddChild(bn);
+ if (n instanceof DataNodeContainer) {
+ level++;
+ collectODL(bluePrint, bn,
+ ((DataNodeContainer) n).getChildNodes(), level);
+ level--;
+ } else if (n instanceof ListSchemaNode) {
+ level++;
+ collectODL(bluePrint, bn,
+ ((ListSchemaNode) n).getChildNodes(), level);
+ level--;
+ }
+ } else {
+ if (parent != null) {
+ parent.addColumn(n, parent.getParent().getBluePrintNodeName());
+ } else {
+ XSQLAdapter.log("NO Parent!");
+ }
+ }
+ }
+ }
+
+ public static Map<String, Field> refFieldsCache =
+ new HashMap<String, Field>();
+
+ public static Field findField(Class<?> c, String name) {
+ if (c == null) {
+ return null;
+ }
+ String cacheKey = c.getName() + name;
+ Field f = refFieldsCache.get(cacheKey);
+ if (f != null) {
+ return f;
+ }
+
+ try {
+ f = c.getDeclaredField(name);
+ f.setAccessible(true);
+ refFieldsCache.put(cacheKey, f);
+ return f;
+ } catch (Exception err) {
+ }
+
+ Class<?> s = c.getSuperclass();
+ if (s != null) {
+ f = findField(s, name);
+ if (f != null) {
+ refFieldsCache.put(cacheKey, f);
+ }
+ return f;
+ }
+ return null;
+ }
+
+
+ public static Object get(Object o, String name) {
+ try {
+ Class<?> c = o.getClass();
+ Field f = findField(c, name);
+ return f.get(o);
+ } catch (Exception err) {
+ XSQLAdapter.log(err);
+ }
+ return null;
+ }
+
+ public static List<Object> getMChildren(Object o) {
+ Map<?, ?> children = getChildren(o);
+ List<Object> result = new LinkedList<Object>();
+ for (Object val : children.values()) {
+ result.add((Object) val);
+ }
+ return result;
+ }
+
+ public static Map<?, ?> getChildren(Object o) {
+ return (Map<?, ?>) get(o, "children");
+ }
+
+ public static Object getValue(Object o) {
+ return get(o, "value");
+ }
+
+ public static String getNodeIdentiofier(Object o) {
+ try{
+ return ((PathArgument) get(o, "nodeIdentifier")).getNodeType().toString();
+ }catch(Exception err){
+ return null;
+ }
+ }
+
+ public static String getNodeName(Object o) {
+ Object nodeID = get(o, "nodeIdentifier");
+ if (nodeID != null) {
+ String nodeName = nodeID.toString();
+ int index = nodeName.lastIndexOf(")");
+ return nodeName.substring(index + 1);
+ }
+ return "NULL";
+ }
+
+ public static Class getTypeForODLColumn(Object odlNode){
+ Object type = get(odlNode,"type");
+ if(type instanceof Uint32 || type instanceof Uint64){
+ return long.class;
+ }else
+ if(type instanceof Uint16){
+ return int.class;
+ }else
+ if(type instanceof Uint8){
+ return byte.class;
+ }
+ return String.class;
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.util.LinkedList;
+
+public class XSQLThreadPool {
+ private LinkedList<Runnable> tasks = new LinkedList<Runnable>();
+ private int threadCount = 0;
+ private int maxThreadCount = 10;
+ private String threadPoolName = "Simple Thread Pool";
+ private int waitTimeForIdle = 10000;
+ private int maxQueueSize = -1;
+ public Object waitForSlotSync = new Object();
+
+ public XSQLThreadPool(int _maxThreadCount, String name,
+ int _waitTimeForIdle) {
+ this.maxThreadCount = _maxThreadCount;
+ this.threadPoolName = name;
+ this.waitTimeForIdle = _waitTimeForIdle;
+ }
+
+ public void addTask(Runnable r) {
+ synchronized (tasks) {
+ tasks.add(r);
+ tasks.notifyAll();
+ if (threadCount < maxThreadCount) {
+ threadCount++;
+ new WorkerThread(threadCount).start();
+ }
+ }
+ }
+
+ private class WorkerThread extends Thread {
+
+ private long lastTimeExecuted = System.currentTimeMillis();
+
+ public WorkerThread(int threadNumber) {
+ super(
+ "Thread #" + threadNumber + " Of Threadpool " + threadPoolName);
+ }
+
+ public void run() {
+ Runnable runthis = null;
+ while (true) {
+ runthis = null;
+ if (maxQueueSize != -1) {
+ synchronized (waitForSlotSync) {
+ if (tasks.size() < maxQueueSize) {
+ waitForSlotSync.notifyAll();
+ }
+ }
+ }
+ synchronized (tasks) {
+ if (tasks.isEmpty()) {
+ try {
+ tasks.wait(2000);
+ } catch (Exception err) {
+ }
+ }
+
+ if (!tasks.isEmpty()) {
+ runthis = tasks.removeFirst();
+ }
+ }
+ if (runthis != null) {
+ try {
+ runthis.run();
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ lastTimeExecuted = System.currentTimeMillis();
+ }
+ if (System.currentTimeMillis() - lastTimeExecuted
+ > waitTimeForIdle) {
+ break;
+ }
+ }
+ synchronized (tasks) {
+ threadCount--;
+ }
+ }
+ }
+
+ public int getNumberOfThreads() {
+ return threadCount;
+ }
+
+ public void waitForSlot() {
+ if (tasks.size() > maxQueueSize) {
+ synchronized (waitForSlotSync) {
+ try {
+ waitForSlotSync.wait();
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public boolean isEmpty() {
+ if (this.threadCount == 0) {
+ return true;
+ }
+ return false;
+ }
+
+ public void setMaxQueueSize(int size) {
+ this.maxQueueSize = size;
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.io.Serializable;
+import java.util.Map;
+
+public class JDBCCommand implements Serializable {
+ public int type = 0;
+ public static final int TYPE_EXECUTE_QUERY = 1;
+ public static final int TYPE_QUERY_REPLY = 2;
+ public static final int TYPE_QUERY_RECORD = 3;
+ public static final int TYPE_QUERY_FINISH = 4;
+ public static final int TYPE_QUERY_ERROR = 5;
+
+ private JDBCResultSet rs = null;
+ private Map record = null;
+ private int rsID = -1;
+ private Exception err = null;
+
+ public JDBCCommand(Exception _err, int _RSID) {
+ this.type = TYPE_QUERY_ERROR;
+ this.err = _err;
+ this.rsID = _RSID;
+ }
+
+ public JDBCCommand(JDBCResultSet _rs, int _type) {
+ this.type = TYPE_EXECUTE_QUERY;
+ this.rs = _rs;
+ this.type = _type;
+ this.rsID = rs.getID();
+ }
+
+ public JDBCCommand(Map _record, int _rsID) {
+ this.record = _record;
+ this.rsID = _rsID;
+ this.type = TYPE_QUERY_RECORD;
+ }
+
+ public JDBCCommand(int _rsID) {
+ this.rsID = _rsID;
+ this.type = TYPE_QUERY_FINISH;
+ }
+
+ public int getType() {
+ return this.type;
+ }
+
+ public JDBCResultSet getRS() {
+ return this.rs;
+ }
+
+ public Map getRecord() {
+ return this.record;
+ }
+
+ public int getRSID() {
+ return this.rsID;
+ }
+
+ public Exception getERROR() {
+ return this.err;
+ }
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
+
+public class JDBCConnection extends Thread implements Connection {
+ private Socket socket = null;
+ private DataInputStream in = null;
+ private DataOutputStream out = null;
+ private LinkedList<byte[]> queue = new LinkedList<byte[]>();
+ private XSQLAdapter adapter = null;
+
+ public JDBCConnection(Socket s, XSQLAdapter _a) {
+ this.socket = s;
+ this.adapter = _a;
+ try {
+ in = new DataInputStream(
+ new BufferedInputStream(s.getInputStream()));
+ out = new DataOutputStream(
+ new BufferedOutputStream(s.getOutputStream()));
+ new JDBCObjectReader();
+ this.start();
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ public JDBCConnection(String addr) throws Exception {
+ socket = new Socket(addr, 40004);
+ try {
+ in = new DataInputStream(
+ new BufferedInputStream(socket.getInputStream()));
+ out = new DataOutputStream(
+ new BufferedOutputStream(socket.getOutputStream()));
+ new JDBCObjectReader();
+ this.start();
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ public JDBCConnection(boolean server) {
+ try {
+ ServerSocket s = new ServerSocket(50003);
+ socket = s.accept();
+ try {
+ in = new DataInputStream(
+ new BufferedInputStream(socket.getInputStream()));
+ out = new DataOutputStream(
+ new BufferedOutputStream(socket.getOutputStream()));
+ new JDBCObjectReader();
+ this.start();
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+
+ private boolean isStopped() {
+ if (adapter != null && adapter.stopped) {
+ return true;
+ }
+ if (socket == null || socket.isClosed()) {
+ return true;
+ }
+ return false;
+ }
+
+ public void run() {
+ byte data[] = null;
+ while (!isStopped()) {
+ try {
+ int len = in.readInt();
+ data = new byte[len];
+ in.readFully(data);
+ addObject(data);
+
+ } catch (Exception err) {
+ System.out.println("Connection Lost or Closed.");
+ try {
+ socket.close();
+ } catch (Exception err2) {
+ }
+ //err.printStackTrace();
+ }
+ }
+ }
+
+ private void addObject(byte[] data) {
+ synchronized (queue) {
+ queue.add(data);
+ queue.notifyAll();
+ }
+ }
+
+ private class JDBCObjectReader extends Thread {
+
+ public JDBCObjectReader() {
+ super("JDBCObjectReader");
+ start();
+ }
+
+ public void run() {
+ while (!isStopped()) {
+ byte data[] = null;
+ synchronized (queue) {
+ if (queue.size() == 0) {
+ try {
+ queue.wait(1000);
+ } catch (Exception err) {
+ }
+ }
+ if (queue.size() > 0) {
+ data = queue.removeFirst();
+ }
+ }
+ if (data != null) {
+ JDBCCommand command = (JDBCCommand) deSerialize(data);
+ processCommand(command);
+ }
+ }
+ }
+
+ private Object deSerialize(byte data[]) {
+ try {
+ ByteArrayInputStream in = new ByteArrayInputStream(data);
+ ObjectInputStream oin = new ObjectInputStream(in);
+ return oin.readObject();
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ return null;
+ }
+ }
+
+ public void processCommand(JDBCCommand cmd) {
+ switch (cmd.getType()) {
+ case JDBCCommand.TYPE_EXECUTE_QUERY:
+ try {
+ JDBCServer.execute(cmd.getRS(), adapter);
+ send(new JDBCCommand(cmd.getRS(),
+ JDBCCommand.TYPE_QUERY_REPLY));
+ QueryUpdater u = new QueryUpdater(cmd.getRS());
+ new Thread(u).start();
+ } catch (Exception err) {
+ send(new JDBCCommand(err, cmd.getRSID()));
+ }
+ break;
+ case JDBCCommand.TYPE_QUERY_REPLY:
+ JDBCResultSet rs1 = JDBCStatement.getQuery(cmd.getRS().getID());
+ rs1.updateData(cmd.getRS());
+ break;
+ case JDBCCommand.TYPE_QUERY_RECORD:
+ JDBCResultSet rs2 = JDBCStatement.getQuery(cmd.getRSID());
+ rs2.addRecord(cmd.getRecord());
+ break;
+ case JDBCCommand.TYPE_QUERY_FINISH:
+ JDBCResultSet rs3 = JDBCStatement.removeQuery(cmd.getRSID());
+ rs3.setFinished(true);
+ break;
+ case JDBCCommand.TYPE_QUERY_ERROR:
+ System.err.println("ERROR Executing Query\n");
+ cmd.getERROR().printStackTrace();
+ JDBCResultSet rs4 = JDBCStatement.removeQuery(cmd.getRSID());
+ rs4.setError(cmd.getERROR());
+ rs4.setFinished(true);
+ synchronized (rs4) {
+ rs4.notifyAll();
+ }
+ }
+ }
+
+ private class QueryUpdater implements Runnable {
+
+ private JDBCResultSet rs = null;
+
+ public QueryUpdater(JDBCResultSet _rs) {
+ this.rs = _rs;
+ }
+
+ public void run() {
+ while (rs.next()) {
+ JDBCCommand rec = new JDBCCommand(rs.getCurrent(), rs.getID());
+ send(rec);
+ }
+ JDBCCommand end = new JDBCCommand(rs.getID());
+ send(end);
+ }
+ }
+
+ public void send(Object o) {
+ try {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream oout = new ObjectOutputStream(bout);
+ oout.writeObject(o);
+ byte data[] = bout.toByteArray();
+ synchronized (socket) {
+ out.writeInt(data.length);
+ out.write(data);
+ out.flush();
+ }
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void clearWarnings() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void close() throws SQLException {
+ try {
+ socket.close();
+ } catch (Exception err) {
+ }
+ socket = null;
+ }
+
+ @Override
+ public void commit() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Array createArrayOf(String typeName, Object[] elements)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Blob createBlob() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Clob createClob() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NClob createNClob() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SQLXML createSQLXML() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Statement createStatement() throws SQLException {
+ return new JDBCStatement(this);
+ }
+
+ @Override
+ public Statement createStatement(int resultSetType,
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Statement createStatement(int resultSetType,
+ int resultSetConcurrency)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Struct createStruct(String typeName, Object[] attributes)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean getAutoCommit() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String getCatalog() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Properties getClientInfo() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getClientInfo(String name) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getHoldability() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public DatabaseMetaData getMetaData() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getTransactionIsolation() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Map<String, Class<?>> getTypeMap() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SQLWarning getWarnings() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isClosed() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isReadOnly() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isValid(int timeout) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String nativeSQL(String sql) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CallableStatement prepareCall(String sql, int resultSetType,
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CallableStatement prepareCall(String sql, int resultSetType,
+ int resultSetConcurrency) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CallableStatement prepareCall(String sql) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, int resultSetType,
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, int resultSetType,
+ int resultSetConcurrency) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql, String[] columnNames)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public PreparedStatement prepareStatement(String sql) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void rollback() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void rollback(Savepoint savepoint) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAutoCommit(boolean autoCommit) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setCatalog(String catalog) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setClientInfo(Properties properties)
+ throws SQLClientInfoException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setClientInfo(String name, String value)
+ throws SQLClientInfoException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setHoldability(int holdability) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setReadOnly(boolean readOnly) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Savepoint setSavepoint() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Savepoint setSavepoint(String name) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setTransactionIsolation(int level) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setSchema(String schema) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getSchema() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void abort(Executor executor) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setNetworkTimeout(Executor executor, int milliseconds)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getNetworkTimeout() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+}
+
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+public class JDBCDriver implements Driver {
+
+ public static JDBCDriver drv = new JDBCDriver();
+
+ public JDBCDriver() {
+ try {
+ DriverManager.registerDriver(this);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean acceptsURL(String arg0) throws SQLException {
+ return true;
+ }
+
+ @Override
+ public Connection connect(String url, Properties arg1) throws SQLException {
+ System.err.println("JDBC Connection");
+ try {
+ if (url.equals("svr")) {
+ return new JDBCConnection(true);
+ } else {
+ return new JDBCConnection(url);
+ }
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public int getMajorVersion() {
+ return 1;
+ }
+
+ @Override
+ public int getMinorVersion() {
+ return 0;
+ }
+
+ @Override
+ public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1)
+ throws SQLException {
+ DriverPropertyInfo i = new DriverPropertyInfo("NQL", "NQL");
+ return new DriverPropertyInfo[] {i};
+ }
+
+ @Override
+ public boolean jdbcCompliant() {
+ return false;
+ }
+
+ @Override
+ public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLODLUtils;
+
+public class JDBCResultSet
+ implements Serializable, ResultSet, ResultSetMetaData {
+ private static final long serialVersionUID = -7450200738431047057L;
+
+ private String sql = null;
+ private List<XSQLBluePrintNode> tablesInQuery =
+ new ArrayList<XSQLBluePrintNode>();
+ private Map<String, XSQLBluePrintNode> tablesInQueryMap =
+ new ConcurrentHashMap<String, XSQLBluePrintNode>();
+ private List<XSQLColumn> fieldsInQuery = new ArrayList<XSQLColumn>();
+ private transient LinkedList<Map> records = new LinkedList<Map>();
+ private transient Map currentRecord = null;
+ private boolean finished = false;
+ private int id = 0;
+ private static Integer nextID = new Integer(0);
+ public int numberOfTasks = 0;
+ private Map<String, Map<XSQLColumn, List<XSQLCriteria>>> criteria =
+ new ConcurrentHashMap<String, Map<XSQLColumn, List<XSQLCriteria>>>();
+ private Exception err = null;
+ private List<Record> EMPTY_RESULT = new LinkedList<Record>();
+
+ public JDBCResultSet(String _sql) {
+ synchronized (JDBCResultSet.class) {
+ nextID++;
+ id = nextID;
+ }
+ this.sql = _sql;
+ }
+
+ public String getSQL() {
+ return this.sql;
+ }
+
+ public void setError(Exception _err) {
+ this.err = _err;
+ }
+
+ public Exception getError() {
+ return this.err;
+ }
+
+ public void updateData(JDBCResultSet rs) {
+ synchronized (this) {
+ this.tablesInQuery = rs.tablesInQuery;
+ this.tablesInQueryMap = rs.tablesInQueryMap;
+ this.fieldsInQuery = rs.fieldsInQuery;
+ this.notifyAll();
+ }
+ }
+
+ public int isObjectFitCriteria(Map objValues, String tableName) {
+ Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria.get(tableName);
+ if (tblCriteria == null) {
+ return 1;
+ }
+ for (Map.Entry<XSQLColumn, List<XSQLCriteria>> cc : tblCriteria
+ .entrySet()) {
+ for (XSQLCriteria c : cc.getValue()) {
+ Object value = objValues.get(cc.getKey().toString());
+ int result = c.checkValue(value);
+ if (result == 0) {
+ return 0;
+ }
+ }
+ }
+ return 1;
+ }
+
+ public int isObjectFitCriteria(Object element, Class cls) {
+ Map<XSQLColumn, List<XSQLCriteria>> tblCriteria =
+ criteria.get(cls.getName());
+ if (tblCriteria == null) {
+ return 1;
+ }
+ for (Map.Entry<XSQLColumn, List<XSQLCriteria>> cc : tblCriteria
+ .entrySet()) {
+ for (XSQLCriteria c : cc.getValue()) {
+ int result =
+ c.isObjectFitCriteria(element, cc.getKey().getName());
+ if (result == 0) {
+ return 0;
+ }
+ }
+ }
+ return 1;
+ }
+
+ public Map<String, Map<XSQLColumn, List<XSQLCriteria>>> getCriteria() {
+ return this.criteria;
+ }
+
+ public int getID() {
+ return this.id;
+ }
+
+ public List<XSQLBluePrintNode> getTables() {
+ return tablesInQuery;
+ }
+
+ public void addTableToQuery(XSQLBluePrintNode node) {
+ if (this.tablesInQueryMap.containsKey(node.getBluePrintNodeName())) {
+ return;
+ }
+ this.tablesInQuery.add(node);
+ this.tablesInQueryMap.put(node.getBluePrintNodeName(), node);
+ }
+
+ public List<XSQLColumn> getFields() {
+ return this.fieldsInQuery;
+ }
+
+ public XSQLBluePrintNode getMainTable() {
+ if (tablesInQuery.size() == 1) {
+ return tablesInQuery.get(0);
+ }
+ XSQLBluePrintNode result = null;
+ for (XSQLBluePrintNode node : tablesInQuery) {
+ if (result == null) {
+ result = node;
+ } else if (result.getLevel() < node.getLevel()) {
+ result = node;
+ }
+ }
+ return result;
+ }
+
+ public boolean isFinished() {
+ return finished;
+ }
+
+ public void setFinished(boolean b) {
+ this.finished = b;
+ }
+
+ public int size() {
+ return this.records.size();
+ }
+
+ public void addRecord(Map r) {
+ synchronized (this) {
+ if (records == null) {
+ records = new LinkedList<Map>();
+ }
+ records.add(r);
+ this.notifyAll();
+ }
+ }
+
+
+ public void addRecord(ArrayList hierarchy) {
+ Map rec = new HashMap();
+ for (int i = hierarchy.size() - 1; i >= 0; i--) {
+ Object element = hierarchy.get(i);
+ for (XSQLColumn c : fieldsInQuery) {
+ if (c.getTableName()
+ .equals(element.getClass().getSimpleName())) {
+ try {
+ Method m = element.getClass().getMethod(c.getName(), null);
+ Object value = m.invoke(element, null);
+ rec.put(c.getName(), value);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+ }
+ }
+ this.records.add(rec);
+ }
+
+ public boolean next() {
+ this.currentRecord = null;
+ if (records == null) {
+ records = new LinkedList<Map>();
+ }
+ while (!finished || records.size() > 0) {
+ synchronized (this) {
+ if (records.size() == 0) {
+ try {
+ this.wait(1000);
+ } catch (Exception err) {
+ }
+ if (records.size() > 0) {
+ try {
+ currentRecord = records.removeFirst();
+ return true;
+ } finally {
+ this.notifyAll();
+ }
+ }
+ } else {
+ try {
+ currentRecord = records.removeFirst();
+ return true;
+ } finally {
+ this.notifyAll();
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public Map getCurrent() {
+ return this.currentRecord;
+ }
+
+ private void createRecord(Object data, XSQLBluePrintNode node) {
+ Map rec = new HashMap();
+ for (XSQLColumn c : this.fieldsInQuery) {
+ if (c.getTableName().equals(node.getBluePrintNodeName())) {
+ try {
+ Method m = node.getInterface().getMethod(c.getName(), null);
+ Object value = m.invoke(data, null);
+ if (value != null) {
+ rec.put(c.getName(), value);
+ } else {
+ rec.put(c.getName(), "");
+ }
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ }
+ }
+ }
+
+ public static class Record {
+ public Map data = new HashMap();
+ public Object element = null;
+
+ public Map getRecord() {
+ return this.data;
+ }
+ }
+
+ private Map collectColumnValues(Object node, XSQLBluePrintNode bpn) {
+ Map subChildren = XSQLODLUtils.getChildren(node);
+ Map result = new HashMap();
+ for (Object stc : subChildren.values()) {
+ if (stc.getClass().getName()
+ .endsWith("ImmutableAugmentationNode")) {
+ Map values = XSQLODLUtils.getChildren(stc);
+ for (Object key : values.keySet()) {
+ Object val = values.get(key);
+ if (val.getClass().getName()
+ .endsWith("ImmutableLeafNode")) {
+ Object value = XSQLODLUtils.getValue(val);
+ String k = XSQLODLUtils.getNodeName(val);
+ if (value != null) {
+ result.put(bpn.getBluePrintNodeName() + "." + k,
+ value.toString());
+ }
+ }
+ }
+ } else if (stc.getClass().getName().endsWith("ImmutableLeafNode")) {
+ String k = XSQLODLUtils.getNodeName(stc);
+ Object value = XSQLODLUtils.getValue(stc);
+ if (value != null) {
+ result.put(bpn.getBluePrintNodeName() + "." + k, value.toString());
+ }
+ }
+ }
+ return result;
+ }
+
+ private void addToData(Record rec, XSQLBluePrintNode bpn, XSQLBluePrint bluePrint, Map fullRecord) {
+ XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(XSQLODLUtils.getNodeIdentiofier(rec.element));
+ if (bpn != null) {
+ for (XSQLColumn c : fieldsInQuery) {
+ for(XSQLBluePrintNode eNode:eNodes){
+ if (((XSQLBluePrintNode) c.getBluePrintNode()).getBluePrintNodeName().equals(eNode.getBluePrintNodeName())) {
+ //Object value = Criteria.getValue(rec.element, c.getName());
+ String columnName = c.toString();
+ Object value = fullRecord.get(columnName);
+ if (value != null) {
+ try {
+ Object rsValue = c.getResultSetValue(value);
+ c.setCharWidth(rsValue.toString().length());
+ rec.data.put(columnName, rsValue);
+ } catch (Exception err) {
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private boolean beenHere(Set<String> beenHereElement, Object element) {
+ if (beenHereElement == null) {
+ beenHereElement = new HashSet<String>();
+ }
+
+ String elementKey = null;
+
+ try {
+ elementKey = element.toString();
+ } catch (Exception err) {
+ elementKey = "Unknown";
+ }
+
+ if (beenHereElement.contains(elementKey)) {
+ return true;
+ }
+
+ beenHereElement.add(elementKey);
+ return false;
+ }
+
+ public List<Object> getChildren(Object node, String tableName,XSQLBluePrint bluePrint) {
+
+ List<Object> children = XSQLODLUtils.getMChildren(node);
+ List<Object> result = new LinkedList<Object>();
+
+ for (Object child : children) {
+
+ String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child);
+ if(odlNodeName==null) continue;
+
+ XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(odlNodeName);
+ if(eNodes==null) continue;
+
+ boolean match = false;
+ for(XSQLBluePrintNode enode:eNodes){
+ if(tableName.startsWith(enode.toString())){
+ match = true;
+ break;
+ }
+ }
+
+ if(!match) continue;
+
+ if (child.getClass().getName().endsWith("ImmutableContainerNode")) {
+ result.add(child);
+ }else
+ if (child.getClass().getName().endsWith("ImmutableAugmentationNode")) {
+ List<Object> _children = XSQLODLUtils.getMChildren(child);
+ for (Object c : _children) {
+ if (c.getClass().getName().endsWith("ImmutableContainerNode")) {
+ result.add(c);
+ }
+ }
+ } else if (child.getClass().getName().endsWith("ImmutableMapNode")) {
+ result.addAll(XSQLODLUtils.getMChildren(child));
+ }
+ }
+ return result;
+ }
+
+ public List<Record> addRecords(Object element, XSQLBluePrintNode node,boolean root, String tableName,XSQLBluePrint bluePrint) {
+
+ List<Record> result = new LinkedList<Record>();
+ String nodeID = XSQLODLUtils.getNodeIdentiofier(element);
+ if (node.getODLTableName().equals(nodeID)) {
+ XSQLBluePrintNode bluePrintNode = bluePrint.getBluePrintNodeByODLTableName(nodeID)[0];
+ Record rec = new Record();
+ rec.element = element;
+ XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode.getBluePrintNodeName());
+ if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName()) || bpn != null) {
+ Map<?, ?> allKeyValues = collectColumnValues(element, bpn);
+ if (!(isObjectFitCriteria(allKeyValues, bpn.getBluePrintNodeName()) == 1)) {
+ return EMPTY_RESULT;
+ }
+ addToData(rec, bpn, bluePrint,allKeyValues);
+ }
+ if (root) {
+ addRecord(rec.data);
+ } else {
+ result.add(rec);
+ }
+ return result;
+ }
+
+ XSQLBluePrintNode parent = node.getParent();
+ List<Record> subRecords = addRecords(element, parent, false, tableName,bluePrint);
+ for (Record subRec : subRecords) {
+ List<Object> subO = getChildren(subRec.element, tableName,bluePrint);
+ if (subO != null) {
+ for (Object subData : subO) {
+ Record rec = new Record();
+ rec.element = subData;
+ rec.data.putAll(subRec.data);
+
+ String recID = XSQLODLUtils.getNodeIdentiofier(rec.element);
+ XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(recID);
+ XSQLBluePrintNode bpn = null;
+ for(XSQLBluePrintNode eNode:eNodes){
+ bpn = this.tablesInQueryMap.get(eNode.getBluePrintNodeName());
+ if(bpn!=null)
+ break;
+ }
+ boolean isObjectInCriteria = true;
+ if (bpn != null) {
+ Map allKeyValues = collectColumnValues(rec.element, bpn);
+ if ((isObjectFitCriteria(allKeyValues, bpn.getBluePrintNodeName()) == 1)) {
+ addToData(rec, bpn,bluePrint,allKeyValues);
+ } else {
+ isObjectInCriteria = false;
+ }
+ }
+
+ if (isObjectInCriteria) {
+ if (root) {
+ if(!rec.data.isEmpty())
+ addRecord(rec.data);
+ } else {
+ result.add(rec);
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean absolute(int row) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void afterLast() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void beforeFirst() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void cancelRowUpdates() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void clearWarnings() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void close() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int findColumn(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean first() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Array getArray(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Array getArray(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getAsciiStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getAsciiStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BigDecimal getBigDecimal(int columnIndex, int scale)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BigDecimal getBigDecimal(String columnLabel, int scale)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getBinaryStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getBinaryStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Blob getBlob(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Blob getBlob(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean getBoolean(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean getBoolean(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public byte getByte(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public byte getByte(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public byte[] getBytes(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public byte[] getBytes(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Reader getCharacterStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Reader getCharacterStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Clob getClob(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Clob getClob(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getConcurrency() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getCursorName() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getDate(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Date getDate(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public double getDouble(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public double getDouble(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getFetchDirection() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getFetchSize() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public float getFloat(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public float getFloat(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getHoldability() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getInt(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getInt(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public long getLong(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public long getLong(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public ResultSetMetaData getMetaData() throws SQLException {
+ return this;
+ }
+
+ @Override
+ public Reader getNCharacterStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Reader getNCharacterStream(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NClob getNClob(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NClob getNClob(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getNString(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getNString(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getObject(int columnIndex, Map<String, Class<?>> map)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getObject(int columnIndex) throws SQLException {
+ return currentRecord
+ .get(this.fieldsInQuery.get(columnIndex - 1).toString());
+ }
+
+ @Override
+ public Object getObject(String columnLabel, Map<String, Class<?>> map)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getObject(String columnLabel) throws SQLException {
+ return currentRecord.get(columnLabel);
+ }
+
+ @Override
+ public Ref getRef(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Ref getRef(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getRow() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public RowId getRowId(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public RowId getRowId(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SQLXML getSQLXML(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SQLXML getSQLXML(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public short getShort(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public short getShort(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Statement getStatement() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getString(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getString(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Time getTime(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Time getTime(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Timestamp getTimestamp(int columnIndex, Calendar cal)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Timestamp getTimestamp(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Timestamp getTimestamp(String columnLabel, Calendar cal)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Timestamp getTimestamp(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getType() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public URL getURL(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public URL getURL(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public InputStream getUnicodeStream(String columnLabel)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SQLWarning getWarnings() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void insertRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isAfterLast() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isBeforeFirst() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isClosed() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isFirst() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isLast() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean last() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void moveToCurrentRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void moveToInsertRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean previous() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void refreshRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean relative(int rows) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean rowDeleted() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean rowInserted() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean rowUpdated() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setFetchDirection(int direction) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFetchSize(int rows) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateArray(int columnIndex, Array x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateArray(String columnLabel, Array x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(int columnIndex, InputStream x, int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(int columnIndex, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(int columnIndex, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(String columnLabel, InputStream x, int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(String columnLabel, InputStream x,
+ long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateAsciiStream(String columnLabel, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBigDecimal(int columnIndex, BigDecimal x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBigDecimal(String columnLabel, BigDecimal x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(int columnIndex, InputStream x, int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(int columnIndex, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(int columnIndex, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(String columnLabel, InputStream x,
+ int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(String columnLabel, InputStream x,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBinaryStream(String columnLabel, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(int columnIndex, Blob x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(int columnIndex, InputStream inputStream,
+ long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(int columnIndex, InputStream inputStream)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(String columnLabel, Blob x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(String columnLabel, InputStream inputStream,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBlob(String columnLabel, InputStream inputStream)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBoolean(String columnLabel, boolean x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateByte(int columnIndex, byte x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateByte(String columnLabel, byte x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateBytes(String columnLabel, byte[] x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(int columnIndex, Reader x, int length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(int columnIndex, Reader x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(int columnIndex, Reader x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(String columnLabel, Reader reader,
+ int length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(String columnLabel, Reader reader,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateCharacterStream(String columnLabel, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(int columnIndex, Clob x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(int columnIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(int columnIndex, Reader reader) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(String columnLabel, Clob x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(String columnLabel, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateClob(String columnLabel, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDate(int columnIndex, Date x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDate(String columnLabel, Date x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDouble(int columnIndex, double x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateDouble(String columnLabel, double x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateFloat(int columnIndex, float x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateFloat(String columnLabel, float x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateInt(int columnIndex, int x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateInt(String columnLabel, int x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateLong(int columnIndex, long x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateLong(String columnLabel, long x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNCharacterStream(int columnIndex, Reader x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNCharacterStream(int columnIndex, Reader x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNCharacterStream(String columnLabel, Reader reader,
+ long length) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNCharacterStream(String columnLabel, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(int columnIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(int columnIndex, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(String columnLabel, NClob nClob)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(String columnLabel, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNClob(String columnLabel, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNString(int columnIndex, String nString)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNString(String columnLabel, String nString)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNull(int columnIndex) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateNull(String columnLabel) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateObject(int columnIndex, Object x, int scaleOrLength)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateObject(int columnIndex, Object x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateObject(String columnLabel, Object x, int scaleOrLength)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateObject(String columnLabel, Object x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateRef(int columnIndex, Ref x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateRef(String columnLabel, Ref x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateRow() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateRowId(int columnIndex, RowId x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateRowId(String columnLabel, RowId x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateSQLXML(int columnIndex, SQLXML xmlObject)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateSQLXML(String columnLabel, SQLXML xmlObject)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateShort(int columnIndex, short x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateShort(String columnLabel, short x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateString(int columnIndex, String x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateString(String columnLabel, String x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateTime(int columnIndex, Time x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateTime(String columnLabel, Time x) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateTimestamp(int columnIndex, Timestamp x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateTimestamp(String columnLabel, Timestamp x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean wasNull() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String getCatalogName(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getColumnClassName(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getColumnCount() throws SQLException {
+ return fieldsInQuery.size();
+ }
+
+ @Override
+ public int getColumnDisplaySize(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getColumnLabel(int column) throws SQLException {
+ return this.fieldsInQuery.get(column - 1).toString();
+ }
+
+ @Override
+ public String getColumnName(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getColumnType(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getColumnTypeName(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getPrecision(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getScale(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public String getSchemaName(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getTableName(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isAutoIncrement(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isCaseSensitive(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isCurrency(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isDefinitelyWritable(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int isNullable(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean isReadOnly(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isSearchable(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isSigned(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isWritable(int column) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> T getObject(String columnLabel, Class<T> type)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+
+ ////Metadata
+
+
+
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class JDBCServer extends Thread {
+ private ServerSocket socket = null;
+ private XSQLAdapter adapter = null;
+
+ public JDBCServer(XSQLAdapter a) {
+ super("JDBC Server");
+ this.adapter = a;
+ start();
+ }
+
+ public void run() {
+ try {
+ socket = new ServerSocket(40004);
+ while (!adapter.stopped) {
+ Socket s = socket.accept();
+ new JDBCConnection(s, adapter);
+ }
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ public void connectToClient(String addr) {
+ try {
+ Socket s = new Socket(addr, 50003);
+ new JDBCConnection(s, adapter);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ public static void execute(JDBCResultSet rs, XSQLAdapter adapter)
+ throws SQLException {
+ parseTables(rs, adapter.getBluePrint());
+ parseFields(rs, adapter.getBluePrint());
+ parseCriteria(rs, adapter.getBluePrint());
+ try {
+ adapter.execute(rs);
+ } catch (Exception err) {
+ throw new SQLException("Error", err);
+ }
+ }
+
+ public static void parseTables(JDBCResultSet rs, XSQLBluePrint bp)
+ throws SQLException {
+ String lowSQL = rs.getSQL().toLowerCase();
+ int from = lowSQL.indexOf("from");
+ int where = lowSQL.indexOf("where");
+ int subQuery = lowSQL.indexOf("select", 2);
+ int fromTo = lowSQL.indexOf(";");
+
+ if (where != -1 && subQuery != -1 && where < subQuery) {
+ fromTo = where;
+ } else if (where != -1 && subQuery != -1 && where > subQuery) {
+ fromTo = subQuery;
+ } else if (where != -1) {
+ fromTo = where;
+ } else if (subQuery != -1) {
+ fromTo = subQuery;
+ }
+
+ if (from == -1) {
+ throw new SQLException("Missing \"from\" statement.");
+ }
+
+ if (fromTo == -1) {
+ throw new SQLException("Missing terminating \";\".");
+ }
+
+ String tableNames = rs.getSQL().substring(from + 4, fromTo).trim();
+ StringTokenizer tokens = new StringTokenizer(tableNames, ",");
+ while (tokens.hasMoreTokens()) {
+ String tableName = tokens.nextToken().trim();
+ XSQLBluePrintNode table = bp.getBluePrintNodeByTableName(tableName);
+ if (table == null) {
+ throw new SQLException(
+ "Unknown table name \"" + tableName + "\"");
+ }
+ rs.addTableToQuery(table);
+ }
+ }
+
+ public static void addCriteria(XSQLColumn col, XSQLCriteria c,
+ JDBCResultSet rs) {
+ Map<XSQLColumn, List<XSQLCriteria>> tblCriteria =
+ rs.getCriteria().get(col.getTableName());
+ if (tblCriteria == null) {
+ tblCriteria =
+ new ConcurrentHashMap<XSQLColumn, List<XSQLCriteria>>();
+ rs.getCriteria().put(col.getTableName(), tblCriteria);
+ }
+ List<XSQLCriteria> lstCriteria = tblCriteria.get(col);
+ if (lstCriteria == null) {
+ lstCriteria = new ArrayList<XSQLCriteria>();
+ tblCriteria.put(col, lstCriteria);
+ }
+ lstCriteria.add(c);
+ }
+
+ public static void parseFields(JDBCResultSet rs, XSQLBluePrint bp)
+ throws SQLException {
+ String lowSQL = rs.getSQL().toLowerCase();
+ if (!lowSQL.startsWith("select")) {
+ throw new SQLException("Missing 'select' statement.");
+ }
+ int from = lowSQL.indexOf("from");
+ if (from == -1) {
+ throw new SQLException("Missing 'from' statement.");
+ }
+ String fields = rs.getSQL().substring(6, from).trim();
+ StringTokenizer tokens = new StringTokenizer(fields, ",");
+ while (tokens.hasMoreTokens()) {
+ String token = tokens.nextToken().trim();
+ if (token.equals("*")) {
+ for (XSQLBluePrintNode table : rs.getTables()) {
+ rs.getFields().addAll(table.getColumns());
+ }
+ return;
+ }
+ if (token.indexOf(".") != -1) {
+ XSQLBluePrintNode tbl = bp.getBluePrintNodeByTableName(
+ token.substring(0, token.indexOf(".")).trim());
+ String p = token.substring(token.indexOf(".") + 1);
+ if (p.equals("*")) {
+ for (XSQLColumn c : tbl.getColumns()) {
+ rs.getFields().add(c);
+ }
+ } else {
+ XSQLColumn col = tbl.findColumnByName(p);
+ rs.getFields().add(col);
+ }
+ } else {
+ XSQLColumn col = null;
+ for (XSQLBluePrintNode table : rs.getTables()) {
+ try {
+ col = table.findColumnByName(token);
+ } catch (Exception err) {
+ }
+ if (col != null) {
+ break;
+ }
+ }
+ if (col == null) {
+ throw new SQLException(
+ "Unknown field name '" + token + "'.");
+ }
+
+ rs.getFields().add(col);
+ }
+ }
+ }
+
+ public static void parseCriteria(JDBCResultSet rs, XSQLBluePrint bp) {
+ String lowSQL = rs.getSQL().toLowerCase();
+ int where = lowSQL.indexOf("where");
+ int order = lowSQL.indexOf("order");
+ int subQuery = lowSQL.indexOf("select", 2);
+ int whereTo = lowSQL.indexOf(";");
+
+ if (where == -1) {
+ return;
+ }
+
+ if (where != -1 && subQuery != -1 && subQuery < where) {
+ return;
+ }
+
+ if (order != -1 && subQuery != -1 && order < subQuery) {
+ whereTo = order;
+ } else if (order != -1 && subQuery != -1 && order > subQuery) {
+ whereTo = subQuery;
+ } else if (order != -1) {
+ whereTo = order;
+ } else if (subQuery != -1) {
+ whereTo = subQuery;
+ }
+ String whereStatement =
+ rs.getSQL().substring(where + 5, whereTo).trim();
+ XSQLCriteria cr = new XSQLCriteria(whereStatement, -1);
+ for (XSQLBluePrintNode tbl : rs.getTables()) {
+ for (XSQLColumn col : tbl.getColumns()) {
+ String colCriteria = cr.getCriteriaForProperty(col);
+ if (colCriteria != null && !colCriteria.trim().equals("")) {
+ addCriteria(col, new XSQLCriteria(colCriteria, -1), rs);
+ }
+ }
+ }
+ }
+}
--- /dev/null
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class JDBCStatement implements Statement {
+ private JDBCResultSet rs = null;
+ private transient JDBCConnection connection = null;
+ private static Map<Integer, JDBCResultSet> queries =
+ new ConcurrentHashMap<Integer, JDBCResultSet>();
+
+ public JDBCStatement(JDBCConnection con) {
+ this.connection = con;
+ }
+
+ public JDBCStatement() {
+
+ }
+
+ public static JDBCResultSet getQuery(int id) {
+ return queries.get(id);
+ }
+
+ public static JDBCResultSet removeQuery(int id) {
+ return queries.remove(id);
+ }
+
+ @Override
+ public java.sql.ResultSet executeQuery(String _sql) throws SQLException {
+ rs = new JDBCResultSet(_sql);
+ queries.put(rs.getID(), rs);
+ synchronized (rs) {
+ this.connection
+ .send(new JDBCCommand(rs, JDBCCommand.TYPE_EXECUTE_QUERY));
+ try {
+ rs.wait();
+ } catch (Exception err) {
+ }
+ if (rs.getError() != null) {
+ throw ((SQLException) rs.getError());
+ }
+ }
+ return rs;
+ }
+
+ @Override
+ public boolean execute(String _sql) throws SQLException {
+ return true;
+ }
+
+ public void addRecord(ArrayList hierarchy) {
+ rs.addRecord(hierarchy);
+ }
+
+ public int size() {
+ return rs.size();
+ }
+
+ public void setFinished(boolean b) {
+ this.rs.setFinished(b);
+ }
+
+ public JDBCResultSet getRS() {
+ return this.rs;
+ }
+
+ public ResultSet getResultSet() {
+ return this.rs;
+ }
+
+ @Override
+ public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void addBatch(String sql) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void cancel() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void clearBatch() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void clearWarnings() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void close() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean execute(String sql, int autoGeneratedKeys)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean execute(String sql, int[] columnIndexes)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean execute(String sql, String[] columnNames)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int[] executeBatch() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int executeUpdate(String sql, int autoGeneratedKeys)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int executeUpdate(String sql, int[] columnIndexes)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int executeUpdate(String sql, String[] columnNames)
+ throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int executeUpdate(String sql) throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Connection getConnection() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getFetchDirection() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getFetchSize() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public java.sql.ResultSet getGeneratedKeys() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getMaxFieldSize() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getMaxRows() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean getMoreResults() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean getMoreResults(int current) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int getQueryTimeout() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getResultSetConcurrency() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getResultSetHoldability() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getResultSetType() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getUpdateCount() throws SQLException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public SQLWarning getWarnings() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isClosed() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isPoolable() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setCursorName(String name) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setEscapeProcessing(boolean enable) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFetchDirection(int direction) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setFetchSize(int rows) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setMaxFieldSize(int max) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setMaxRows(int max) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setPoolable(boolean poolable) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setQueryTimeout(int seconds) throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void closeOnCompletion() throws SQLException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isCloseOnCompletion() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+}
--- /dev/null
+package org.opendaylight.xsql;
+
+import java.util.concurrent.ExecutionException;
+
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQL;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQLBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Created by root on 6/26/14.
+ */
+public class XSQLProvider implements AutoCloseable {
+
+ public static final InstanceIdentifier<XSQL> ID = InstanceIdentifier.builder(XSQL.class).build();
+ private static final Logger LOG = LoggerFactory.getLogger(XSQLProvider.class);
+
+ public void close() {
+ }
+
+ public XSQL buildXSQL(DataProviderService dps) {
+ XSQLBuilder builder = new XSQLBuilder();
+ builder.setPort("34343");
+ XSQL xsql = builder.build();
+ if (dps != null) {
+ final DataModificationTransaction t = dps.beginTransaction();
+ t.removeOperationalData(ID);
+ t.putOperationalData(ID,xsql);
+
+ try {
+ t.commit().get();
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.warn("Failed to update toaster status, operational otherwise", e);
+ }
+ }
+ return xsql;
+ }
+}
--- /dev/null
+package org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626;
+
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
+import org.opendaylight.xsql.XSQLProvider;
+
+public class XSQLModule extends org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.AbstractXSQLModule {
+ public XSQLModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public XSQLModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQLModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ XSQLAdapter xsqlAdapter = XSQLAdapter.getInstance();
+ getSchemaServiceDependency().registerSchemaServiceListener(xsqlAdapter);
+ xsqlAdapter.setDataBroker(getAsyncDataBrokerDependency());
+ XSQLProvider p = new XSQLProvider();
+ p.buildXSQL(getDataBrokerDependency());
+ return p;
+ }
+
+}
--- /dev/null
+/*
+* Generated file
+*
+* Generated from: yang module name: XSQL yang module local name: XSQL
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Jun 26 14:56:25 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626;
+public class XSQLModuleFactory extends org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.AbstractXSQLModuleFactory {
+
+}
--- /dev/null
+<snapshot>
+ <configuration>
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+ <type xmlns:XSQL="http://netconfcentral.org/ns/XSQL">
+ XSQL:XSQL
+ </type>
+ <name>XSQL</name>
+ <data-broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+ <async-data-broker>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+ <name>inmemory-data-broker</name>
+ </async-data-broker>
+ <schema-service>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+ <name>yang-schema-service</name>
+ </schema-service>
+ </module>
+ </modules>
+ </data>
+ </configuration>
+ <required-capabilities>
+ <capability>http://netconfcentral.org/ns/XSQL?module=XSQL&revision=2014-06-26</capability>
+ </required-capabilities>
+</snapshot>
--- /dev/null
+module XSQL{
+ yang-version 1;
+ namespace "http://netconfcentral.org/ns/XSQL";
+ prefix XSQL;
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+ import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+ import opendaylight-md-sal-dom {prefix sal;}
+ import opendaylight-md-sal-common {prefix common;}
+
+ organization "Netconf Central";
+ contact "Sharon Aicler <saichler@cisco.com>";
+ description "YANG version of the XSQL status";
+
+ revision "2014-06-26" {
+ description "XSQL module initial version";
+ }
+
+ container XSQL {
+ presence "Indicates the XSQL service is available";
+ description "Container to indicate the XSQL availability";
+ leaf port {
+ type string;
+ config false;
+ mandatory true;
+ description "The port the XSQL binds on";
+ }
+ }
+
+ identity XSQL {
+ base config:module-type;
+ config:java-name-prefix XSQL;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case XSQL {
+ when "/config:modules/config:module/config:type = 'XSQL'";
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity mdsal:binding-data-broker;
+ }
+ }
+ }
+
+ container async-data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity sal:dom-async-data-broker;
+ }
+ }
+
+ }
+
+ container schema-service {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity sal:schema-service;
+ }
+ }
+
+ }
+
+ }
+ }
+
+}
@Override
public java.lang.AutoCloseable createInstance() {
InMemoryDOMDataStore ids = new InMemoryDOMDataStore("DOM-OPER", MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()));
- getSchemaServiceDependency().registerSchemaServiceListener(ids);
+ getOperationalSchemaServiceDependency().registerSchemaServiceListener(ids);
return ids;
}
package org.opendaylight.controller.md.sal.dom.store.impl;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(ChangeListenerNotifyTask.class);
private final Iterable<? extends DataChangeListenerRegistration<?>> listeners;
- private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> event;
+ private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> event;
public ChangeListenerNotifyTask(final Iterable<? extends DataChangeListenerRegistration<?>> listeners,
- final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> event) {
+ final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> event) {
this.listeners = listeners;
this.event = event;
}
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Preconditions;
public final class DOMImmutableDataChangeEvent implements
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> {
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
private static final RemoveEventFactory REMOVE_EVENT_FACTORY = new RemoveEventFactory();
private final NormalizedNode<?, ?> original;
private final NormalizedNode<?, ?> updated;
- private final Map<InstanceIdentifier, NormalizedNode<?, ?>> originalData;
- private final Map<InstanceIdentifier, NormalizedNode<?, ?>> createdData;
- private final Map<InstanceIdentifier, NormalizedNode<?, ?>> updatedData;
- private final Set<InstanceIdentifier> removedPaths;
+ private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> originalData;
+ private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> createdData;
+ private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> updatedData;
+ private final Set<YangInstanceIdentifier> removedPaths;
private final DataChangeScope scope;
}
@Override
- public Map<InstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
return originalData;
}
@Override
- public Map<InstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
return createdData;
}
@Override
- public Map<InstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+ public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
return updatedData;
}
@Override
- public Set<InstanceIdentifier> getRemovedPaths() {
+ public Set<YangInstanceIdentifier> getRemovedPaths() {
return removedPaths;
}
*
*/
public interface SimpleEventFactory {
- DOMImmutableDataChangeEvent create(InstanceIdentifier path, NormalizedNode<PathArgument,?> data);
+ DOMImmutableDataChangeEvent create(YangInstanceIdentifier path, NormalizedNode<PathArgument,?> data);
}
/**
private NormalizedNode<?, ?> after;
private NormalizedNode<?, ?> before;
- private final Map<InstanceIdentifier, NormalizedNode<?, ?>> original = new HashMap<>();
- private final Map<InstanceIdentifier, NormalizedNode<?, ?>> created = new HashMap<>();
- private final Map<InstanceIdentifier, NormalizedNode<?, ?>> updated = new HashMap<>();
- private final Set<InstanceIdentifier> removed = new HashSet<>();
+ private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> original = new HashMap<>();
+ private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> created = new HashMap<>();
+ private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> updated = new HashMap<>();
+ private final Set<YangInstanceIdentifier> removed = new HashSet<>();
private Builder(final DataChangeScope scope) {
Preconditions.checkNotNull(scope, "Data change scope should not be null.");
return this;
}
- public Builder addCreated(final InstanceIdentifier path, final NormalizedNode<?, ?> node) {
+ public Builder addCreated(final YangInstanceIdentifier path, final NormalizedNode<?, ?> node) {
created.put(path, node);
return this;
}
- public Builder addRemoved(final InstanceIdentifier path, final NormalizedNode<?, ?> node) {
+ public Builder addRemoved(final YangInstanceIdentifier path, final NormalizedNode<?, ?> node) {
original.put(path, node);
removed.add(path);
return this;
}
- public Builder addUpdated(final InstanceIdentifier path, final NormalizedNode<?, ?> before,
+ public Builder addUpdated(final YangInstanceIdentifier path, final NormalizedNode<?, ?> before,
final NormalizedNode<?, ?> after) {
original.put(path, before);
updated.put(path, after);
private static final class RemoveEventFactory implements SimpleEventFactory {
@Override
- public DOMImmutableDataChangeEvent create(final InstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
+ public DOMImmutableDataChangeEvent create(final YangInstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
return builder(DataChangeScope.BASE) //
.setBefore(data) //
.addRemoved(path, data) //
private static final class CreateEventFactory implements SimpleEventFactory {
@Override
- public DOMImmutableDataChangeEvent create(final InstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
+ public DOMImmutableDataChangeEvent create(final YangInstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
return builder(DataChangeScope.BASE) //
.setAfter(data) //
.addCreated(path, data) //
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public interface DataChangeListenerRegistration<L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> extends ListenerRegistration<L> {
+public interface DataChangeListenerRegistration<L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> extends ListenerRegistration<L> {
@Override
L getInstance();
- InstanceIdentifier getPath();
+ YangInstanceIdentifier getPath();
DataChangeScope getScope();
}
import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
executor.shutdownNow();
}
@Override
- public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
- final InstanceIdentifier path, final L listener, final DataChangeScope scope) {
+ public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
+ final YangInstanceIdentifier path, final L listener, final DataChangeScope scope) {
/*
* Make sure commit is not occurring right now. Listener has to be
import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree.Node;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree.Walker;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
* - After state of current node
* @return Data Change Event of this node and all it's children
*/
- private DOMImmutableDataChangeEvent resolveAnyChangeEvent(final InstanceIdentifier path,
+ private DOMImmutableDataChangeEvent resolveAnyChangeEvent(final YangInstanceIdentifier path,
final Collection<ListenerTree.Node> listeners, final DataTreeCandidateNode node) {
if (node.getModificationType() != ModificationType.UNMODIFIED &&
throw new IllegalStateException(String.format("Unhandled node state %s at %s", node.getModificationType(), path));
}
- private DOMImmutableDataChangeEvent resolveReplacedEvent(final InstanceIdentifier path,
+ private DOMImmutableDataChangeEvent resolveReplacedEvent(final YangInstanceIdentifier path,
final Collection<Node> listeners, final NormalizedNode<?, ?> beforeData,
final NormalizedNode<?, ?> afterData) {
}
}
- private DOMImmutableDataChangeEvent resolveNodeContainerReplaced(final InstanceIdentifier path,
+ private DOMImmutableDataChangeEvent resolveNodeContainerReplaced(final YangInstanceIdentifier path,
final Collection<Node> listeners,
final NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> beforeCont,
final NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> afterCont) {
for (NormalizedNode<PathArgument, ?> beforeChild : beforeCont.getValue()) {
PathArgument childId = beforeChild.getIdentifier();
alreadyProcessed.add(childId);
- InstanceIdentifier childPath = path.node(childId);
+ YangInstanceIdentifier childPath = path.node(childId);
Collection<ListenerTree.Node> childListeners = getListenerChildrenWildcarded(listeners, childId);
Optional<NormalizedNode<PathArgument, ?>> afterChild = afterCont.getChild(childId);
DOMImmutableDataChangeEvent childChange = resolveNodeContainerChildUpdated(childPath, childListeners,
// and it was not present in previous loop, that means it is
// created.
Collection<ListenerTree.Node> childListeners = getListenerChildrenWildcarded(listeners, childId);
- InstanceIdentifier childPath = path.node(childId);
+ YangInstanceIdentifier childPath = path.node(childId);
childChanges.add(resolveSameEventRecursivelly(childPath , childListeners, afterChild,
DOMImmutableDataChangeEvent.getCreateEventFactory()));
}
return replaceEvent;
}
- private DOMImmutableDataChangeEvent resolveNodeContainerChildUpdated(final InstanceIdentifier path,
+ private DOMImmutableDataChangeEvent resolveNodeContainerChildUpdated(final YangInstanceIdentifier path,
final Collection<Node> listeners, final NormalizedNode<PathArgument, ?> before,
final Optional<NormalizedNode<PathArgument, ?>> after) {
* @param afterState
* @return
*/
- private DOMImmutableDataChangeEvent resolveCreateEvent(final InstanceIdentifier path,
+ private DOMImmutableDataChangeEvent resolveCreateEvent(final YangInstanceIdentifier path,
final Collection<ListenerTree.Node> listeners, final NormalizedNode<?, ?> afterState) {
@SuppressWarnings({ "unchecked", "rawtypes" })
final NormalizedNode<PathArgument, ?> node = (NormalizedNode) afterState;
return resolveSameEventRecursivelly(path, listeners, node, DOMImmutableDataChangeEvent.getCreateEventFactory());
}
- private DOMImmutableDataChangeEvent resolveDeleteEvent(final InstanceIdentifier path,
+ private DOMImmutableDataChangeEvent resolveDeleteEvent(final YangInstanceIdentifier path,
final Collection<ListenerTree.Node> listeners, final NormalizedNode<?, ?> beforeState) {
@SuppressWarnings({ "unchecked", "rawtypes" })
return resolveSameEventRecursivelly(path, listeners, node, DOMImmutableDataChangeEvent.getRemoveEventFactory());
}
- private DOMImmutableDataChangeEvent resolveSameEventRecursivelly(final InstanceIdentifier path,
+ private DOMImmutableDataChangeEvent resolveSameEventRecursivelly(final YangInstanceIdentifier path,
final Collection<Node> listeners, final NormalizedNode<PathArgument, ?> node,
final SimpleEventFactory eventFactory) {
final DOMImmutableDataChangeEvent event = eventFactory.create(path, node);
return propagateEvent;
}
- private DOMImmutableDataChangeEvent resolveSubtreeChangeEvent(final InstanceIdentifier path,
+ private DOMImmutableDataChangeEvent resolveSubtreeChangeEvent(final YangInstanceIdentifier path,
final Collection<ListenerTree.Node> listeners, final DataTreeCandidateNode modification) {
Preconditions.checkArgument(modification.getDataBefore().isPresent(), "Subtree change with before-data not present at path %s", path);
boolean oneModified = false;
for (DataTreeCandidateNode childMod : modification.getChildNodes()) {
PathArgument childId = childMod.getIdentifier();
- InstanceIdentifier childPath = path.node(childId);
+ YangInstanceIdentifier childPath = path.node(childId);
Collection<ListenerTree.Node> childListeners = getListenerChildrenWildcarded(listeners, childId);
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
@Override
- public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final InstanceIdentifier path) {
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final YangInstanceIdentifier path) {
checkNotNull(path, "Path must not be null.");
checkState(stableSnapshot != null, "Transaction is closed");
return Futures.immediateFuture(stableSnapshot.readNode(path));
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
@Override
- public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final InstanceIdentifier path) {
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final YangInstanceIdentifier path) {
LOG.debug("Tx: {} Read: {}", getIdentifier(), path);
try {
return Futures.immediateFuture(getMutatedView().readNode(path));
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
@Override
- public void write(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ public void write(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
checkNotReady();
try {
LOG.debug("Tx: {} Write: {}:{}", getIdentifier(), path, data);
}
@Override
- public void merge(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ public void merge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
checkNotReady();
try {
LOG.debug("Tx: {} Merge: {}:{}", getIdentifier(), path, data);
}
@Override
- public void delete(final InstanceIdentifier path) {
+ public void delete(final YangInstanceIdentifier path) {
checkNotReady();
try {
LOG.debug("Tx: {} Delete: {}", getIdentifier(), path);
import org.opendaylight.controller.md.sal.dom.store.impl.DataChangeListenerRegistration;
import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
import org.opendaylight.yangtools.concepts.Identifiable;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
import org.slf4j.Logger;
* @param scope Scope of triggering event.
* @return Listener registration
*/
- public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L> registerDataChangeListener(final InstanceIdentifier path,
+ public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L> registerDataChangeListener(final YangInstanceIdentifier path,
final L listener, final DataChangeScope scope) {
// Take the write lock
}
@Override
- public InstanceIdentifier getPath() {
+ public YangInstanceIdentifier getPath() {
return path;
}
}
- private abstract static class DataChangeListenerRegistrationImpl<T extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> extends AbstractListenerRegistration<T> //
+ private abstract static class DataChangeListenerRegistrationImpl<T extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> extends AbstractListenerRegistration<T> //
implements DataChangeListenerRegistration<T> {
public DataChangeListenerRegistrationImpl(final T listener) {
super(listener);
case inmemory-operational-datastore-provider {
when "/config:modules/config:module/config:type = 'inmemory-operational-datastore-provider'";
- container schema-service {
+ // Yang does not allow two cases from same namespaces with same children
+ // Schema-service dependency renamed to operational-schema-service
+ // to prevent conflict with schema-service container from inmemory-config-datastore-provider
+ container operational-schema-service {
uses config:service-ref {
refine type {
mandatory false;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
public abstract class AbstractDataChangeListenerTest {
- protected static final InstanceIdentifier TOP_LEVEL = InstanceIdentifier
+ protected static final YangInstanceIdentifier TOP_LEVEL = YangInstanceIdentifier
.of(Top.QNAME);
private static final QName NAME_QNAME = QName.create(Top.QNAME, "name");
protected static final String FOO = "foo";
}
- public static final InstanceIdentifier path(final String topName,
+ public static final YangInstanceIdentifier path(final String topName,
final String nestedName) {
return path(topName).node(NestedList.QNAME).node(
new NodeIdentifierWithPredicates(NestedList.QNAME, NAME_QNAME,
nestedName));
}
- public static final InstanceIdentifier path(final String topName) {
+ public static final YangInstanceIdentifier path(final String topName) {
return TOP_LEVEL.node(TopLevelList.QNAME).node(
new NodeIdentifierWithPredicates(TopLevelList.QNAME,
NAME_QNAME, topName));
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import com.google.common.base.Preconditions;
public class DatastoreTestTask {
private final DOMStore store;
- private AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> changeListener;
+ private AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> changeListener;
private WriteTransactionCustomizer setup;
private WriteTransactionCustomizer write;
private ReadTransactionVerifier read;
private WriteTransactionCustomizer cleanup;
- private InstanceIdentifier changePath;
+ private YangInstanceIdentifier changePath;
private DataChangeScope changeScope;
private boolean postSetup = false;
private final ChangeEventListener internalListener;
internalListener = new ChangeEventListener();
}
- public DatastoreTestTask changeListener(final InstanceIdentifier path, final DataChangeScope scope,
- final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> changeListener) {
+ public DatastoreTestTask changeListener(final YangInstanceIdentifier path, final DataChangeScope scope,
+ final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> changeListener) {
this.changeListener = changeListener;
this.changePath = path;
this.changeScope = scope;
return this;
}
- public DatastoreTestTask changeListener(final InstanceIdentifier path, final DataChangeScope scope) {
+ public DatastoreTestTask changeListener(final YangInstanceIdentifier path, final DataChangeScope scope) {
this.changePath = path;
this.changeScope = scope;
return this;
}
}
- public Future<AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>> getChangeEvent() {
+ public Future<AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>> getChangeEvent() {
return internalListener.receivedChange;
}
}
private final class ChangeEventListener implements
- AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+ AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
- protected final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>> receivedChange = SettableFuture
+ protected final SettableFuture<AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>> receivedChange = SettableFuture
.create();
@Override
- public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+ public void onDataChanged(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
if (postSetup) {
receivedChange.set(change);
}
}
}
- public static final WriteTransactionCustomizer simpleWrite(final InstanceIdentifier path,
+ public static final WriteTransactionCustomizer simpleWrite(final YangInstanceIdentifier path,
final NormalizedNode<?, ?> data) {
return new WriteTransactionCustomizer() {
};
}
- public static final WriteTransactionCustomizer simpleMerge(final InstanceIdentifier path,
+ public static final WriteTransactionCustomizer simpleMerge(final YangInstanceIdentifier path,
final NormalizedNode<?, ?> data) {
return new WriteTransactionCustomizer() {
};
}
- public static final WriteTransactionCustomizer simpleDelete(final InstanceIdentifier path) {
+ public static final WriteTransactionCustomizer simpleDelete(final YangInstanceIdentifier path) {
return new WriteTransactionCustomizer() {
@Override
public void customize(final DOMStoreReadWriteTransaction tx) {
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
@Override
public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), TOP_LEVEL, path(FOO), path(FOO, BAR));
assertEmpty(change.getUpdatedData());
public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO, BAZ));
assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), TOP_LEVEL, path(FOO), path(FOO, BAR), path(FOO, BAZ));
assertEmpty(change.getUpdatedData());
protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertEmpty(change.getCreatedData());
assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
protected void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertEmpty(change.getCreatedData());
assertEmpty(change.getUpdatedData());
@Override
protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO,BAZ));
assertNotContains(change.getCreatedData(), path(FOO,BAR));
@Override
protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO,BAR),path(FOO,BAZ));
assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
@Override
protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO_SIBLING));
assertContains(change.getUpdatedData(), TOP_LEVEL);
import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class SchemaUpdateForTransactionTest {
- private static final InstanceIdentifier TOP_PATH = InstanceIdentifier.of(Top.QNAME);
+ private static final YangInstanceIdentifier TOP_PATH = YangInstanceIdentifier.of(Top.QNAME);
private SchemaContext schemaContext;
private InMemoryDOMDataStore domStore;
package org.opendaylight.controller.md.sal.dom.store.impl;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
- public static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
- public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+ public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
+ public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite {
- private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+ private static final YangInstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
TopLevelList.QNAME);
@Override
@Override
public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
assertContains(change.getCreatedData(), path(FOO, BAZ));
protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
assertFalse(change.getCreatedData().isEmpty());
public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertEmpty(change.getCreatedData());
assertEmpty(change.getUpdatedData());
@Override
protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO_SIBLING));
assertNotContains(change.getUpdatedData(), path(FOO), TOP_LEVEL);
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
- private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+ private static final YangInstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
TopLevelList.QNAME);
@Override
@Override
public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
assertContains(change.getCreatedData(), path(FOO, BAZ));
protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
assertFalse(change.getCreatedData().isEmpty());
public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertEmpty(change.getCreatedData());
assertEmpty(change.getUpdatedData());
@Override
protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO_SIBLING));
assertNotContains(change.getUpdatedData(),path(FOO), TOP_LEVEL);
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
- private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+ private static final YangInstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
TopLevelList.QNAME);
@Override
@Override
public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotContains(change.getCreatedData(), TOP_LEVEL);
assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR));
public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
assertContains(change.getCreatedData(), path(FOO, BAZ));
protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
assertFalse(change.getCreatedData().isEmpty());
protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertNotNull(change);
assertTrue(change.getCreatedData().isEmpty());
assertContains(change.getUpdatedData(), path(FOO));
public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertEmpty(change.getCreatedData());
assertEmpty(change.getUpdatedData());
@Override
protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO,BAZ));
assertNotContains(change.getCreatedData(), path(FOO,BAR));
@Override
protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO,BAR),path(FOO,BAZ));
assertContains(change.getUpdatedData(), path(FOO));
@Override
protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
- AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+ AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
assertContains(change.getCreatedData(), path(FOO_SIBLING));
assertNotContains(change.getUpdatedData(), path(FOO), TOP_LEVEL);
<dependencies>
<dependency>
-
<groupId>${project.groupId}</groupId>
<artifactId>netconf-client</artifactId>
<version>${netconf.version}</version>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-inventory</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-broker-impl</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-impl</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-broker-impl</artifactId>
- <type>jar</type>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>mockito-configuration</artifactId>
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.connect.netconf.sal;
-
-import java.util.concurrent.ExecutionException;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class NetconfDeviceCommitHandler implements DataCommitHandler<InstanceIdentifier,CompositeNode> {
-
- private static final Logger logger= LoggerFactory.getLogger(NetconfDeviceCommitHandler.class);
-
- private final RemoteDeviceId id;
- private final RpcImplementation rpc;
- private final boolean rollbackSupported;
-
- public NetconfDeviceCommitHandler(final RemoteDeviceId id, final RpcImplementation rpc, final boolean rollbackSupported) {
- this.id = id;
- this.rpc = rpc;
- this.rollbackSupported = rollbackSupported;
- }
-
- @Override
- public DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
- final DataModification<InstanceIdentifier, CompositeNode> modification) {
-
- final NetconfDeviceTwoPhaseCommitTransaction twoPhaseCommit = new NetconfDeviceTwoPhaseCommitTransaction(id, rpc,
- modification, true, rollbackSupported);
- try {
- twoPhaseCommit.prepare();
- } catch (final InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new RuntimeException(id + ": Interrupted while waiting for response", e);
- } catch (final ExecutionException e) {
- logger.warn("{}: Error executing pre commit operation on remote device", id, e);
- return new FailingTransaction(twoPhaseCommit, e);
- }
-
- return twoPhaseCommit;
- }
-
- /**
- * Always fail commit transaction that rolls back delegate transaction afterwards
- */
- private class FailingTransaction implements DataCommitTransaction<InstanceIdentifier, CompositeNode> {
- private final NetconfDeviceTwoPhaseCommitTransaction twoPhaseCommit;
- private final ExecutionException e;
-
- public FailingTransaction(final NetconfDeviceTwoPhaseCommitTransaction twoPhaseCommit, final ExecutionException e) {
- this.twoPhaseCommit = twoPhaseCommit;
- this.e = e;
- }
-
- @Override
- public DataModification<InstanceIdentifier, CompositeNode> getModification() {
- return twoPhaseCommit.getModification();
- }
-
- @Override
- public RpcResult<Void> finish() throws IllegalStateException {
- return RpcResultBuilder.<Void>failed().withError( RpcError.ErrorType.APPLICATION,
- id + ": Unexpected operation error during pre-commit operations", e ).build();
- }
-
- @Override
- public RpcResult<Void> rollback() throws IllegalStateException {
- return twoPhaseCommit.rollback();
- }
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+
+package org.opendaylight.controller.sal.connect.netconf.sal;
+
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.controller.sal.connect.netconf.listener.NetconfSessionCapabilities;
+import org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceReadOnlyTx;
+import org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceReadWriteTx;
+import org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceWriteOnlyTx;
+import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+final class NetconfDeviceDataBroker implements DOMDataBroker {
+ private final RemoteDeviceId id;
+ private final RpcImplementation rpc;
+ private final NetconfSessionCapabilities netconfSessionPreferences;
+ private final DataNormalizer normalizer;
+
+ public NetconfDeviceDataBroker(final RemoteDeviceId id, final RpcImplementation rpc, final SchemaContext schemaContext, NetconfSessionCapabilities netconfSessionPreferences) {
+ this.id = id;
+ this.rpc = rpc;
+ this.netconfSessionPreferences = netconfSessionPreferences;
+ normalizer = new DataNormalizer(schemaContext);
+ }
+
+ @Override
+ public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
+ return new NetconfDeviceReadOnlyTx(rpc, normalizer);
+ }
+
+ @Override
+ public DOMDataReadWriteTransaction newReadWriteTransaction() {
+ return new NetconfDeviceReadWriteTx(newReadOnlyTransaction(), newWriteOnlyTransaction());
+ }
+
+ @Override
+ public DOMDataWriteTransaction newWriteOnlyTransaction() {
+ // FIXME detect if candidate is supported, true is hardcoded
+ return new NetconfDeviceWriteOnlyTx(id, rpc, normalizer, true, netconfSessionPreferences.isRollbackSupported());
+ }
+
+ @Override
+ public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store, final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+ throw new UnsupportedOperationException("Data change listeners not supported for netconf mount point");
+ }
+
+ @Override
+ public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
+ // TODO implement
+ throw new UnsupportedOperationException("Transaction chains not supported for netconf mount point");
+ }
+}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.connect.netconf.sal;
-
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.CONFIG_SOURCE_RUNNING;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_DATA_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.toFilterStructure;
-
-import java.util.concurrent.ExecutionException;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataReader;
-import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
-import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.Node;
-import org.opendaylight.yangtools.yang.data.api.SimpleNode;
-
-public final class NetconfDeviceDataReader implements DataReader<InstanceIdentifier,CompositeNode> {
-
- private final RpcImplementation rpc;
- private final RemoteDeviceId id;
-
- public NetconfDeviceDataReader(final RemoteDeviceId id, final RpcImplementation rpc) {
- this.id = id;
- this.rpc = rpc;
- }
-
- @Override
- public CompositeNode readConfigurationData(final InstanceIdentifier path) {
- final RpcResult<CompositeNode> result;
- try {
- result = rpc.invokeRpc(NETCONF_GET_CONFIG_QNAME,
- NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, CONFIG_SOURCE_RUNNING, toFilterStructure(path))).get();
- } catch (final InterruptedException e) {
- throw onInterruptedException(e);
- } catch (final ExecutionException e) {
- throw new RuntimeException(id + ": Read configuration data " + path + " failed", e);
- }
-
- final CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
- return data == null ? null : (CompositeNode) findNode(data, path);
- }
-
- private RuntimeException onInterruptedException(final InterruptedException e) {
- Thread.currentThread().interrupt();
- return new RuntimeException(id + ": Interrupted while waiting for response", e);
- }
-
- @Override
- public CompositeNode readOperationalData(final InstanceIdentifier path) {
- final RpcResult<CompositeNode> result;
- try {
- result = rpc.invokeRpc(NETCONF_GET_QNAME, NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, toFilterStructure(path))).get();
- } catch (final InterruptedException e) {
- throw onInterruptedException(e);
- } catch (final ExecutionException e) {
- throw new RuntimeException(id + ": Read operational data " + path + " failed", e);
- }
-
- final CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
- return (CompositeNode) findNode(data, path);
- }
-
- private static Node<?> findNode(final CompositeNode node, final InstanceIdentifier identifier) {
-
- Node<?> current = node;
- for (final InstanceIdentifier.PathArgument arg : identifier.getPathArguments()) {
- if (current instanceof SimpleNode<?>) {
- return null;
- } else if (current instanceof CompositeNode) {
- final CompositeNode currentComposite = (CompositeNode) current;
-
- current = currentComposite.getFirstCompositeByName(arg.getNodeType());
- if (current == null) {
- current = currentComposite.getFirstCompositeByName(arg.getNodeType().withoutRevision());
- }
- if (current == null) {
- current = currentComposite.getFirstSimpleByName(arg.getNodeType());
- }
- if (current == null) {
- current = currentComposite.getFirstSimpleByName(arg.getNodeType().withoutRevision());
- }
- if (current == null) {
- return null;
- }
- }
- }
- return current;
- }
-}
package org.opendaylight.controller.sal.connect.netconf.sal;
import com.google.common.base.Function;
+import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.inventory.rev140108.NetconfNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.inventory.rev140108.NetconfNodeBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger logger = LoggerFactory.getLogger(NetconfDeviceDatastoreAdapter.class);
private final RemoteDeviceId id;
- private final DataProviderService dataService;
- private final ListeningExecutorService executor;
+ private final DataBroker dataService;
- NetconfDeviceDatastoreAdapter(final RemoteDeviceId deviceId, final DataProviderService dataService,
- final ExecutorService executor) {
+ NetconfDeviceDatastoreAdapter(final RemoteDeviceId deviceId, final DataBroker dataService) {
this.id = Preconditions.checkNotNull(deviceId);
this.dataService = Preconditions.checkNotNull(dataService);
- this.executor = MoreExecutors.listeningDecorator(Preconditions.checkNotNull(executor));
- // Initial data change scheduled
- submitDataChangeToExecutor(this.executor, new Runnable() {
- @Override
- public void run() {
- initDeviceData();
- }
- }, deviceId);
+ initDeviceData();
}
public void updateDeviceState(final boolean up, final Set<QName> capabilities) {
- submitDataChangeToExecutor(this.executor, new Runnable() {
- @Override
- public void run() {
- updateDeviceStateInternal(up, capabilities);
- }
- }, id);
- }
-
- private void updateDeviceStateInternal(final boolean up, final Set<QName> capabilities) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node data = buildDataForDeviceState(
up, capabilities, id);
- final DataModificationTransaction transaction = dataService.beginTransaction();
- logger.trace("{}: Update device state transaction {} putting operational data started.", id, transaction.getIdentifier());
- transaction.removeOperationalData(id.getBindingPath());
- transaction.putOperationalData(id.getBindingPath(), data);
- logger.trace("{}: Update device state transaction {} putting operational data ended.", id, transaction.getIdentifier());
+ final ReadWriteTransaction transaction = dataService.newReadWriteTransaction();
+ logger.trace("{}: Update device state transaction {} merging operational data started.", id, transaction.getIdentifier());
+ transaction.merge(LogicalDatastoreType.OPERATIONAL, id.getBindingPath(), data);
+ logger.trace("{}: Update device state transaction {} merging operational data ended.", id, transaction.getIdentifier());
commitTransaction(transaction, "update");
}
private void removeDeviceConfigAndState() {
- final DataModificationTransaction transaction = dataService.beginTransaction();
+ final WriteTransaction transaction = dataService.newWriteOnlyTransaction();
logger.trace("{}: Close device state transaction {} removing all data started.", id, transaction.getIdentifier());
- transaction.removeConfigurationData(id.getBindingPath());
- transaction.removeOperationalData(id.getBindingPath());
+ transaction.delete(LogicalDatastoreType.CONFIGURATION, id.getBindingPath());
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, id.getBindingPath());
logger.trace("{}: Close device state transaction {} removing all data ended.", id, transaction.getIdentifier());
commitTransaction(transaction, "close");
}
private void initDeviceData() {
- final DataModificationTransaction transaction = dataService.beginTransaction();
+ final WriteTransaction transaction = dataService.newWriteOnlyTransaction();
- final InstanceIdentifier<Node> path = id.getBindingPath();
+ createNodesListIfNotPresent(transaction);
+ final InstanceIdentifier<Node> path = id.getBindingPath();
final Node nodeWithId = getNodeWithId(id);
- if (operationalNodeNotExisting(transaction, path)) {
- transaction.putOperationalData(path, nodeWithId);
- }
- if (configurationNodeNotExisting(transaction, path)) {
- transaction.putConfigurationData(path, nodeWithId);
- }
- commitTransaction(transaction, "init");
- }
+ logger.trace("{}: Init device state transaction {} putting if absent operational data started.", id, transaction.getIdentifier());
+ transaction.merge(LogicalDatastoreType.OPERATIONAL, path, nodeWithId);
+ logger.trace("{}: Init device state transaction {} putting operational data ended.", id, transaction.getIdentifier());
- private void commitTransaction(final DataModificationTransaction transaction, final String txType) {
- // attempt commit
- final RpcResult<TransactionStatus> result;
- try {
- result = transaction.commit().get();
- } catch (InterruptedException | ExecutionException e) {
- logger.error("{}: Transaction({}) failed", id, txType, e);
- throw new IllegalStateException(id + " Transaction(" + txType + ") not committed correctly", e);
- }
-
- // verify success result + committed state
- if (isUpdateSuccessful(result)) {
- logger.trace("{}: Transaction({}) {} SUCCESSFUL", id, txType, transaction.getIdentifier());
- } else {
- logger.error("{}: Transaction({}) {} FAILED!", id, txType, transaction.getIdentifier());
- throw new IllegalStateException(id + " Transaction(" + txType + ") not committed correctly, " +
- "Errors: " + result.getErrors());
- }
- }
+ logger.trace("{}: Init device state transaction {} putting if absent config data started.", id, transaction.getIdentifier());
+ transaction.merge(LogicalDatastoreType.CONFIGURATION, path, nodeWithId);
+ logger.trace("{}: Init device state transaction {} putting config data ended.", id, transaction.getIdentifier());
- @Override
- public void close() throws Exception {
- // Remove device data from datastore
- submitDataChangeToExecutor(executor, new Runnable() {
- @Override
- public void run() {
- removeDeviceConfigAndState();
- }
- }, id);
+ commitTransaction(transaction, "init");
}
- private static boolean isUpdateSuccessful(final RpcResult<TransactionStatus> result) {
- return result.getResult() == TransactionStatus.COMMITED && result.isSuccessful();
+ private void createNodesListIfNotPresent(final WriteTransaction writeTx) {
+ final Nodes nodes = new NodesBuilder().build();
+ final InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).build();
+ logger.trace("{}: Merging {} container to ensure its presence", id, Nodes.QNAME, writeTx.getIdentifier());
+ writeTx.merge(LogicalDatastoreType.CONFIGURATION, path, nodes);
+ writeTx.merge(LogicalDatastoreType.OPERATIONAL, path, nodes);
}
- private static void submitDataChangeToExecutor(final ListeningExecutorService executor, final Runnable r,
- final RemoteDeviceId id) {
- // Submit data change
- final ListenableFuture<?> f = executor.submit(r);
- // Verify update execution
- Futures.addCallback(f, new FutureCallback<Object>() {
+ private void commitTransaction(final WriteTransaction transaction, final String txType) {
+ logger.trace("{}: Committing Transaction {}:{}", id, txType, transaction.getIdentifier());
+ final CheckedFuture<Void, TransactionCommitFailedException> result = transaction.submit();
+
+ Futures.addCallback(result, new FutureCallback<Void>() {
@Override
- public void onSuccess(final Object result) {
- logger.debug("{}: Device data updated successfully", id);
+ public void onSuccess(final Void result) {
+ logger.trace("{}: Transaction({}) {} SUCCESSFUL", id, txType, transaction.getIdentifier());
}
@Override
public void onFailure(final Throwable t) {
- logger.warn("{}: Device data update failed", id, t);
+ logger.error("{}: Transaction({}) {} FAILED!", id, txType, transaction.getIdentifier(), t);
+ throw new IllegalStateException(id + " Transaction(" + txType + ") not committed correctly", t);
}
});
+
+ }
+
+ @Override
+ public void close() throws Exception {
+ removeDeviceConfigAndState();
}
public static org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node buildDataForDeviceState(
return nodeBuilder.build();
}
- private static boolean configurationNodeNotExisting(final DataModificationTransaction transaction,
- final InstanceIdentifier<Node> path) {
- return null == transaction.readConfigurationData(path);
- }
-
- private static boolean operationalNodeNotExisting(final DataModificationTransaction transaction,
+ private static ListenableFuture<Optional<Node>> readNodeData(
+ final LogicalDatastoreType store,
+ final ReadWriteTransaction transaction,
final InstanceIdentifier<Node> path) {
- return null == transaction.readOperationalData(path);
+ return transaction.read(store, path);
}
private static Node getNodeWithId(final RemoteDeviceId id) {
return Collections.emptySet();
}
+ // TODO change this to work with NormalizedNode api. Then we can loose DataNormalizer from Transactions
+
@Override
public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(final QName rpc, final CompositeNode input) {
final NetconfMessage message = transformRequest(rpc, input);
*/
package org.opendaylight.controller.sal.connect.netconf.sal;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
+
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.connect.api.RemoteDeviceHandler;
import org.opendaylight.controller.sal.connect.netconf.listener.NetconfSessionCapabilities;
import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
import org.opendaylight.controller.sal.core.api.Broker;
import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
+import org.opendaylight.controller.sal.dom.broker.impl.NotificationRouterImpl;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker;
+import org.opendaylight.controller.sal.dom.broker.spi.NotificationRouter;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
public final class NetconfDeviceSalFacade implements AutoCloseable, RemoteDeviceHandler<NetconfSessionCapabilities> {
private static final Logger logger= LoggerFactory.getLogger(NetconfDeviceSalFacade.class);
- private static final InstanceIdentifier ROOT_PATH = InstanceIdentifier.builder().toInstance();
private final RemoteDeviceId id;
private final NetconfDeviceSalProvider salProvider;
@Override
public synchronized void onDeviceConnected(final SchemaContextProvider remoteSchemaContextProvider,
final NetconfSessionCapabilities netconfSessionPreferences, final RpcImplementation deviceRpc) {
- salProvider.getMountInstance().setSchemaContext(remoteSchemaContextProvider.getSchemaContext());
+ final SchemaContext schemaContext = remoteSchemaContextProvider.getSchemaContext();
+
+ // TODO remove deprecated SchemaContextProvider from SchemaAwareRpcBroker
+ // TODO move SchemaAwareRpcBroker from sal-broker-impl, now we have depend on the whole sal-broker-impl
+ final RpcProvisionRegistry rpcRegistry = new SchemaAwareRpcBroker(id.getPath().toString(), new org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider() {
+ @Override
+ public SchemaContext getSchemaContext() {
+ return schemaContext;
+ }
+ });
+ registerRpcsToSal(schemaContext, rpcRegistry, deviceRpc);
+ final DOMDataBroker domBroker = new NetconfDeviceDataBroker(id, deviceRpc, schemaContext, netconfSessionPreferences);
+
+ // TODO NotificationPublishService and NotificationRouter have the same interface
+ final NotificationPublishService notificationService = new NotificationPublishService() {
+
+ private final NotificationRouter innerRouter = new NotificationRouterImpl();
+
+ @Override
+ public void publish(final CompositeNode notification) {
+ innerRouter.publish(notification);
+ }
+
+ @Override
+ public ListenerRegistration<NotificationListener> addNotificationListener(final QName notification, final NotificationListener listener) {
+ return innerRouter.addNotificationListener(notification, listener);
+ }
+ };
+
+ salProvider.getMountInstance().onDeviceConnected(schemaContext, domBroker, rpcRegistry, notificationService);
salProvider.getDatastoreAdapter().updateDeviceState(true, netconfSessionPreferences.getModuleBasedCaps());
- registerDataHandlersToSal(deviceRpc, netconfSessionPreferences);
- registerRpcsToSal(deviceRpc);
}
@Override
public void onDeviceDisconnected() {
salProvider.getDatastoreAdapter().updateDeviceState(false, Collections.<QName>emptySet());
+ salProvider.getMountInstance().onDeviceDisconnected();
}
- private void registerRpcsToSal(final RpcImplementation deviceRpc) {
- final MountProvisionInstance mountInstance = salProvider.getMountInstance();
-
+ private void registerRpcsToSal(final SchemaContext schemaContext, final RpcProvisionRegistry rpcRegistry, final RpcImplementation deviceRpc) {
final Map<QName, String> failedRpcs = Maps.newHashMap();
- for (final RpcDefinition rpcDef : mountInstance.getSchemaContext().getOperations()) {
+ for (final RpcDefinition rpcDef : schemaContext.getOperations()) {
try {
- salRegistrations.add(mountInstance.addRpcImplementation(rpcDef.getQName(), deviceRpc));
+ salRegistrations.add(rpcRegistry.addRpcImplementation(rpcDef.getQName(), deviceRpc));
logger.debug("{}: Rpc {} from netconf registered successfully", id, rpcDef.getQName());
} catch (final Exception e) {
// Only debug per rpc, warn for all of them at the end to pollute log a little less (e.g. routed rpcs)
}
}
- private void registerDataHandlersToSal(final RpcImplementation deviceRpc,
- final NetconfSessionCapabilities netconfSessionPreferences) {
- final NetconfDeviceDataReader dataReader = new NetconfDeviceDataReader(id, deviceRpc);
- final NetconfDeviceCommitHandler commitHandler = new NetconfDeviceCommitHandler(id, deviceRpc,
- netconfSessionPreferences.isRollbackSupported());
-
- final MountProvisionInstance mountInstance = salProvider.getMountInstance();
- salRegistrations.add(mountInstance.registerConfigurationReader(ROOT_PATH, dataReader));
- salRegistrations.add(mountInstance.registerOperationalReader(ROOT_PATH, dataReader));
- salRegistrations.add(mountInstance.registerCommitHandler(ROOT_PATH, commitHandler));
- }
-
@Override
public void close() {
for (final AutoCloseable reg : Lists.reverse(salRegistrations)) {
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.ExecutorService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
import org.opendaylight.controller.sal.core.api.Broker;
import org.opendaylight.controller.sal.core.api.Provider;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final RemoteDeviceId id;
private final ExecutorService executor;
- private volatile MountProvisionInstance mountInstance;
private volatile NetconfDeviceDatastoreAdapter datastoreAdapter;
+ private MountInstance mountInstance;
public NetconfDeviceSalProvider(final RemoteDeviceId deviceId, final ExecutorService executor) {
this.id = deviceId;
this.executor = executor;
}
- public MountProvisionInstance getMountInstance() {
+ public MountInstance getMountInstance() {
Preconditions.checkState(mountInstance != null,
- "%s: Sal provider was not initialized by sal. Cannot get mount instance", id);
+ "%s: Mount instance was not initialized by sal. Cannot get mount instance", id);
return mountInstance;
}
@Override
public void onSessionInitiated(final Broker.ProviderSession session) {
- final MountProvisionService mountService = session.getService(MountProvisionService.class);
+ logger.debug("{}: (BI)Session with sal established {}", id, session);
+
+ final DOMMountPointService mountService = session.getService(DOMMountPointService.class);
if (mountService != null) {
- mountInstance = mountService.createOrGetMountPoint(id.getPath());
+ mountInstance = new MountInstance(mountService, id);
}
-
- logger.debug("{}: (BI)Session with sal established {}", id, session);
}
@Override
@Override
public void onSessionInitiated(final BindingAwareBroker.ProviderContext session) {
- final DataProviderService dataBroker = session.getSALService(DataProviderService.class);
- datastoreAdapter = new NetconfDeviceDatastoreAdapter(id, dataBroker, executor);
-
logger.debug("{}: Session with sal established {}", id, session);
+
+ final DataBroker dataBroker = session.getSALService(DataBroker.class);
+ datastoreAdapter = new NetconfDeviceDatastoreAdapter(id, dataBroker);
}
@Override
- public void onSessionInitialized(final BindingAwareBroker.ConsumerContext session) {
- }
+ public void onSessionInitialized(final BindingAwareBroker.ConsumerContext session) {}
public void close() throws Exception {
- mountInstance = null;
+ mountInstance.close();
datastoreAdapter.close();
datastoreAdapter = null;
}
+ static final class MountInstance implements AutoCloseable {
+
+ private DOMMountPointService mountService;
+ private final RemoteDeviceId id;
+ private ObjectRegistration<DOMMountPoint> registration;
+ private NotificationPublishService notificationSerivce;
+
+ MountInstance(final DOMMountPointService mountService, final RemoteDeviceId id) {
+ this.mountService = Preconditions.checkNotNull(mountService);
+ this.id = Preconditions.checkNotNull(id);
+ }
+
+ synchronized void onDeviceConnected(final SchemaContext initialCtx,
+ final DOMDataBroker broker, final RpcProvisionRegistry rpc,
+ final NotificationPublishService notificationSerivce) {
+
+ Preconditions.checkNotNull(mountService, "Closed");
+ Preconditions.checkState(registration == null, "Already initialized");
+
+ final DOMMountPointService.DOMMountPointBuilder mountBuilder = mountService.createMountPoint(id.getPath());
+ mountBuilder.addInitialSchemaContext(initialCtx);
+
+ mountBuilder.addService(DOMDataBroker.class, broker);
+ mountBuilder.addService(RpcProvisionRegistry.class, rpc);
+ this.notificationSerivce = notificationSerivce;
+ mountBuilder.addService(NotificationPublishService.class, notificationSerivce);
+
+ registration = mountBuilder.register();
+ }
+
+ synchronized void onDeviceDisconnected() {
+ if(registration == null) {
+ return;
+ }
+
+ try {
+ registration.close();
+ } catch (final Exception e) {
+ // Only log and ignore
+ logger.warn("Unable to unregister mount instance for {}. Ignoring exception", id.getPath(), e);
+ } finally {
+ registration = null;
+ }
+ }
+
+ @Override
+ synchronized public void close() throws Exception {
+ if(registration != null) {
+ onDeviceDisconnected();
+ }
+ mountService = null;
+ }
+
+ public synchronized void publish(final CompositeNode domNotification) {
+ Preconditions.checkNotNull(notificationSerivce, "Device not set up yet, cannot handle notification {}", domNotification);
+ notificationSerivce.publish(domNotification);
+ }
+ }
+
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+package org.opendaylight.controller.sal.connect.netconf.sal.tx;
+
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.CONFIG_SOURCE_RUNNING;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_DATA_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.toFilterStructure;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
+import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class NetconfDeviceReadOnlyTx implements DOMDataReadOnlyTransaction {
+
+ private static final Logger LOG = LoggerFactory.getLogger(NetconfDeviceReadOnlyTx.class);
+
+ private final RpcImplementation rpc;
+ private final DataNormalizer normalizer;
+
+ public NetconfDeviceReadOnlyTx(final RpcImplementation rpc, final DataNormalizer normalizer) {
+ this.rpc = rpc;
+ this.normalizer = normalizer;
+ }
+
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> readConfigurationData(final YangInstanceIdentifier path) {
+ final ListenableFuture<RpcResult<CompositeNode>> future = rpc.invokeRpc(NETCONF_GET_CONFIG_QNAME,
+ NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, CONFIG_SOURCE_RUNNING, toFilterStructure(path)));
+
+ return Futures.transform(future, new Function<RpcResult<CompositeNode>, Optional<NormalizedNode<?, ?>>>() {
+ @Override
+ public Optional<NormalizedNode<?, ?>> apply(final RpcResult<CompositeNode> result) {
+ final CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
+ final CompositeNode node = (CompositeNode) findNode(data, path);
+
+ return data == null ?
+ Optional.<NormalizedNode<?, ?>>absent() :
+ transform(path, node);
+ }
+ });
+ }
+
+ private Optional<NormalizedNode<?, ?>> transform(final YangInstanceIdentifier path, final CompositeNode node) {
+ if(node == null) {
+ return Optional.absent();
+ }
+ try {
+ return Optional.<NormalizedNode<?, ?>>of(normalizer.toNormalized(path, node).getValue());
+ } catch (final Exception e) {
+ LOG.error("Unable to normalize data for {}, data: {}", path, node, e);
+ throw e;
+ }
+ }
+
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> readOperationalData(final YangInstanceIdentifier path) {
+ final ListenableFuture<RpcResult<CompositeNode>> future = rpc.invokeRpc(NETCONF_GET_QNAME, NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, toFilterStructure(path)));
+
+ return Futures.transform(future, new Function<RpcResult<CompositeNode>, Optional<NormalizedNode<?, ?>>>() {
+ @Override
+ public Optional<NormalizedNode<?, ?>> apply(final RpcResult<CompositeNode> result) {
+ final CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
+ final CompositeNode node = (CompositeNode) findNode(data, path);
+
+ return data == null ?
+ Optional.<NormalizedNode<?, ?>>absent() :
+ transform(path, node);
+ }
+ });
+ }
+
+ private static Node<?> findNode(final CompositeNode node, final YangInstanceIdentifier identifier) {
+
+ Node<?> current = node;
+ for (final YangInstanceIdentifier.PathArgument arg : identifier.getPathArguments()) {
+ if (current instanceof SimpleNode<?>) {
+ return null;
+ } else if (current instanceof CompositeNode) {
+ final CompositeNode currentComposite = (CompositeNode) current;
+
+ current = currentComposite.getFirstCompositeByName(arg.getNodeType());
+ if (current == null) {
+ current = currentComposite.getFirstCompositeByName(arg.getNodeType().withoutRevision());
+ }
+ if (current == null) {
+ current = currentComposite.getFirstSimpleByName(arg.getNodeType());
+ }
+ if (current == null) {
+ current = currentComposite.getFirstSimpleByName(arg.getNodeType().withoutRevision());
+ }
+ if (current == null) {
+ return null;
+ }
+ }
+ }
+ return current;
+ }
+
+ @Override
+ public void close() {
+ // NOOP
+ }
+
+ @Override
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ final YangInstanceIdentifier legacyPath = toLegacyPath(normalizer, path);
+
+ switch (store) {
+ case CONFIGURATION : {
+ return readConfigurationData(legacyPath);
+ }
+ case OPERATIONAL : {
+ return readOperationalData(legacyPath);
+ }
+ }
+
+ throw new IllegalArgumentException(String.format("Cannot read data %s for %s datastore, unknown datastore type", path, store));
+ }
+
+ static YangInstanceIdentifier toLegacyPath(final DataNormalizer normalizer, final YangInstanceIdentifier path) {
+ try {
+ return normalizer.toLegacy(path);
+ } catch (final DataNormalizationException e) {
+ throw new IllegalArgumentException("Cannot normalize path " + path, e);
+ }
+ }
+
+ @Override
+ public Object getIdentifier() {
+ return this;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ */
+
+package org.opendaylight.controller.sal.connect.netconf.sal.tx;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class NetconfDeviceReadWriteTx implements DOMDataReadWriteTransaction {
+
+ private final DOMDataReadTransaction delegateReadTx;
+ private final DOMDataWriteTransaction delegateWriteTx;
+
+ public NetconfDeviceReadWriteTx(final DOMDataReadTransaction delegateReadTx, final DOMDataWriteTransaction delegateWriteTx) {
+ this.delegateReadTx = delegateReadTx;
+ this.delegateWriteTx = delegateWriteTx;
+ }
+
+ @Override
+ public boolean cancel() {
+ return delegateWriteTx.cancel();
+ }
+
+ @Override
+ public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ delegateWriteTx.put(store, path, data);
+ }
+
+ @Override
+ public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ delegateWriteTx.merge(store, path, data);
+ }
+
+ @Override
+ public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ delegateWriteTx.delete(store, path);
+ }
+
+ @Override
+ public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+ return delegateWriteTx.submit();
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+ return delegateWriteTx.commit();
+ }
+
+ @Override
+ public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ return delegateReadTx.read(store, path);
+ }
+
+ @Override
+ public Object getIdentifier() {
+ return this;
+ }
+}
*
* 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
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
*/
-package org.opendaylight.controller.sal.connect.netconf.sal;
+
+package org.opendaylight.controller.sal.connect.netconf.sal.tx;
import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_CANDIDATE_QNAME;
import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME;
import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_TARGET_QNAME;
import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.ROLLBACK_ON_ERROR_OPTION;
+import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-
-import java.util.Collection;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import javax.annotation.Nullable;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
import org.opendaylight.controller.sal.core.api.RpcImplementation;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.ModifyAction;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- * Remote transaction that delegates data change to remote device using netconf messages.
- */
-final class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransaction<InstanceIdentifier, CompositeNode> {
+public class NetconfDeviceWriteOnlyTx implements DOMDataWriteTransaction {
- private static final Logger LOG = LoggerFactory.getLogger(NetconfDeviceTwoPhaseCommitTransaction.class);
+ private static final Logger LOG = LoggerFactory.getLogger(NetconfDeviceWriteOnlyTx.class);
- private final DataModification<InstanceIdentifier, CompositeNode> modification;
+ private final RemoteDeviceId id;
private final RpcImplementation rpc;
+ private final DataNormalizer normalizer;
private final boolean rollbackSupported;
- private final RemoteDeviceId id;
private final CompositeNode targetNode;
- public NetconfDeviceTwoPhaseCommitTransaction(final RemoteDeviceId id, final RpcImplementation rpc,
- final DataModification<InstanceIdentifier, CompositeNode> modification,
- final boolean candidateSupported, final boolean rollbackOnErrorSupported) {
+ public NetconfDeviceWriteOnlyTx(final RemoteDeviceId id, final RpcImplementation rpc, final DataNormalizer normalizer, final boolean candidateSupported, final boolean rollbackOnErrorSupported) {
this.id = id;
- this.rpc = Preconditions.checkNotNull(rpc);
- this.modification = Preconditions.checkNotNull(modification);
+ this.rpc = rpc;
+ this.normalizer = normalizer;
this.targetNode = getTargetNode(candidateSupported);
this.rollbackSupported = rollbackOnErrorSupported;
}
- /**
- * Prepare phase, sends 1 or more netconf edit config operations to modify the data
- *
- * In case of failure or unexpected error response, ExecutionException is thrown
- */
- void prepare() throws InterruptedException, ExecutionException {
- for (final InstanceIdentifier toRemove : modification.getRemovedConfigurationData()) {
- sendDelete(toRemove);
- }
- for(final Entry<InstanceIdentifier, CompositeNode> toUpdate : modification.getUpdatedConfigurationData().entrySet()) {
- sendMerge(toUpdate.getKey(),toUpdate.getValue());
+ // FIXME add logging
+
+ @Override
+ public boolean cancel() {
+ if(isCommitted()) {
+ return false;
}
+
+ return discardChanges();
}
- private void sendMerge(final InstanceIdentifier key, final CompositeNode value) throws InterruptedException, ExecutionException {
- sendEditRpc(createEditConfigStructure(key, Optional.<ModifyAction>absent(), Optional.of(value)), Optional.<ModifyAction>absent());
+ private boolean isCommitted() {
+ // TODO 732
+ return true;
}
- private void sendDelete(final InstanceIdentifier toDelete) throws InterruptedException, ExecutionException {
- sendEditRpc(createEditConfigStructure(toDelete, Optional.of(ModifyAction.DELETE), Optional.<CompositeNode>absent()), Optional.of(ModifyAction.NONE));
+ private boolean discardChanges() {
+ // TODO 732
+ return true;
}
- private void sendEditRpc(final CompositeNode editStructure, final Optional<ModifyAction> defaultOperation) throws InterruptedException, ExecutionException {
- final ImmutableCompositeNode editConfigRequest = createEditConfigRequest(editStructure, defaultOperation);
- final RpcResult<CompositeNode> rpcResult = rpc.invokeRpc(NETCONF_EDIT_CONFIG_QNAME, editConfigRequest).get();
+ // TODO should the edit operations be blocking ?
- // Check result
- if(rpcResult.isSuccessful() == false) {
- throw new ExecutionException(
- String.format("%s: Pre-commit rpc failed, request: %s, errors: %s", id, editConfigRequest, rpcResult.getErrors()), null);
+ @Override
+ public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ Preconditions.checkArgument(store == LogicalDatastoreType.CONFIGURATION, "Can merge only configuration, not %s", store);
+
+ try {
+ final YangInstanceIdentifier legacyPath = NetconfDeviceReadOnlyTx.toLegacyPath(normalizer, path);
+ final CompositeNode legacyData = normalizer.toLegacy(path, data);
+ sendEditRpc(createEditConfigStructure(legacyPath, Optional.of(ModifyAction.REPLACE), Optional.fromNullable(legacyData)), Optional.of(ModifyAction.NONE));
+ } catch (final ExecutionException e) {
+ LOG.warn("Error putting data to {}, data: {}, discarding changes", path, data, e);
+ discardChanges();
+ throw new RuntimeException("Error while replacing " + path, e);
}
}
- private ImmutableCompositeNode createEditConfigRequest(final CompositeNode editStructure, final Optional<ModifyAction> defaultOperation) {
- final CompositeNodeBuilder<ImmutableCompositeNode> ret = ImmutableCompositeNode.builder();
+ @Override
+ public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ Preconditions.checkArgument(store == LogicalDatastoreType.CONFIGURATION, "Can merge only configuration, not %s", store);
- // Target
- final Node<?> targetWrapperNode = ImmutableCompositeNode.create(NETCONF_TARGET_QNAME, ImmutableList.<Node<?>>of(targetNode));
- ret.add(targetWrapperNode);
+ try {
+ final YangInstanceIdentifier legacyPath = NetconfDeviceReadOnlyTx.toLegacyPath(normalizer, path);
+ final CompositeNode legacyData = normalizer.toLegacy(path, data);
+ sendEditRpc(
+ createEditConfigStructure(legacyPath, Optional.<ModifyAction> absent(), Optional.fromNullable(legacyData)), Optional.<ModifyAction> absent());
+ } catch (final ExecutionException e) {
+ LOG.warn("Error merging data to {}, data: {}, discarding changes", path, data, e);
+ discardChanges();
+ throw new RuntimeException("Error while merging " + path, e);
+ }
+ }
- // Default operation
- if(defaultOperation.isPresent()) {
- final SimpleNode<String> defOp = NodeFactory.createImmutableSimpleNode(NETCONF_DEFAULT_OPERATION_QNAME, null, modifyOperationToXmlString(defaultOperation.get()));
- ret.add(defOp);
+ @Override
+ public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+ Preconditions.checkArgument(store == LogicalDatastoreType.CONFIGURATION, "Can merge only configuration, not %s", store);
+
+ try {
+ sendEditRpc(createEditConfigStructure(NetconfDeviceReadOnlyTx.toLegacyPath(normalizer, path), Optional.of(ModifyAction.DELETE), Optional.<CompositeNode>absent()), Optional.of(ModifyAction.NONE));
+ } catch (final ExecutionException e) {
+ LOG.warn("Error deleting data {}, discarding changes", path, e);
+ discardChanges();
+ throw new RuntimeException("Error while deleting " + path, e);
}
+ }
- // Error option
- if(rollbackSupported) {
- ret.addLeaf(NETCONF_ERROR_OPTION_QNAME, ROLLBACK_ON_ERROR_OPTION);
+ @Override
+ public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+ final ListenableFuture<Void> commmitFutureAsVoid = Futures.transform(commit(), new Function<RpcResult<TransactionStatus>, Void>() {
+ @Nullable
+ @Override
+ public Void apply(@Nullable final RpcResult<TransactionStatus> input) {
+ return null;
+ }
+ });
+
+ return Futures.makeChecked(commmitFutureAsVoid, new Function<Exception, TransactionCommitFailedException>() {
+ @Override
+ public TransactionCommitFailedException apply(final Exception input) {
+ return new TransactionCommitFailedException("Submit of transaction " + getIdentifier() + " failed", input);
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+ // FIXME do not allow commit if closed or failed
+
+ final ListenableFuture<RpcResult<CompositeNode>> rpcResult = rpc.invokeRpc(NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME, getCommitRequest());
+ return Futures.transform(rpcResult, new Function<RpcResult<CompositeNode>, RpcResult<TransactionStatus>>() {
+ @Override
+ public RpcResult<TransactionStatus> apply(@Nullable final RpcResult<CompositeNode> input) {
+ if(input.isSuccessful()) {
+ return RpcResultBuilder.success(TransactionStatus.COMMITED).build();
+ } else {
+ final RpcResultBuilder<TransactionStatus> failed = RpcResultBuilder.failed();
+ for (final RpcError rpcError : input.getErrors()) {
+ failed.withError(rpcError.getErrorType(), rpcError.getTag(), rpcError.getMessage(), rpcError.getApplicationTag(), rpcError.getInfo(), rpcError.getCause());
+ }
+ return failed.build();
+ }
+ }
+ });
+
+ // FIXME 732 detect commit failure
+ }
+
+ private void sendEditRpc(final CompositeNode editStructure, final Optional<ModifyAction> defaultOperation) throws ExecutionException {
+ final CompositeNode editConfigRequest = createEditConfigRequest(editStructure, defaultOperation);
+ final RpcResult<CompositeNode> rpcResult;
+ try {
+ rpcResult = rpc.invokeRpc(NETCONF_EDIT_CONFIG_QNAME, editConfigRequest).get();
+ } catch (final InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new RuntimeException(id + ": Interrupted while waiting for response", e);
}
- ret.setQName(NETCONF_EDIT_CONFIG_QNAME);
- // Edit content
- ret.add(editStructure);
- return ret.toInstance();
+ // Check result
+ if(rpcResult.isSuccessful() == false) {
+ throw new ExecutionException(
+ String.format("%s: Pre-commit rpc failed, request: %s, errors: %s", id, editConfigRequest, rpcResult.getErrors()), null);
+ }
}
- private CompositeNode createEditConfigStructure(final InstanceIdentifier dataPath, final Optional<ModifyAction> operation,
- final Optional<CompositeNode> lastChildOverride) {
+ private CompositeNode createEditConfigStructure(final YangInstanceIdentifier dataPath, final Optional<ModifyAction> operation,
+ final Optional<CompositeNode> lastChildOverride) {
Preconditions.checkArgument(Iterables.isEmpty(dataPath.getPathArguments()) == false, "Instance identifier with empty path %s", dataPath);
- List<PathArgument> reversedPath = Lists.reverse(dataPath.getPath());
+ List<YangInstanceIdentifier.PathArgument> reversedPath = Lists.reverse(dataPath.getPath());
// Create deepest edit element with expected edit operation
CompositeNode previous = getDeepestEditElement(reversedPath.get(0), operation, lastChildOverride);
reversedPath.remove(0);
// Create edit structure in reversed order
- for (final PathArgument arg : reversedPath) {
+ for (final YangInstanceIdentifier.PathArgument arg : reversedPath) {
final CompositeNodeBuilder<ImmutableCompositeNode> builder = ImmutableCompositeNode.builder();
builder.setQName(arg.getNodeType());
}
private void addPredicatesToCompositeNodeBuilder(final Map<QName, Object> predicates, final CompositeNodeBuilder<ImmutableCompositeNode> builder) {
- for (final Entry<QName, Object> entry : predicates.entrySet()) {
+ for (final Map.Entry<QName, Object> entry : predicates.entrySet()) {
builder.addLeaf(entry.getKey(), entry.getValue());
}
}
- private Map<QName, Object> getPredicates(final PathArgument arg) {
+ private Map<QName, Object> getPredicates(final YangInstanceIdentifier.PathArgument arg) {
Map<QName, Object> predicates = Collections.emptyMap();
- if (arg instanceof NodeIdentifierWithPredicates) {
- predicates = ((NodeIdentifierWithPredicates) arg).getKeyValues();
+ if (arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
+ predicates = ((YangInstanceIdentifier.NodeIdentifierWithPredicates) arg).getKeyValues();
}
return predicates;
}
- private CompositeNode getDeepestEditElement(final PathArgument arg, final Optional<ModifyAction> operation, final Optional<CompositeNode> lastChildOverride) {
+ private CompositeNode getDeepestEditElement(final YangInstanceIdentifier.PathArgument arg, final Optional<ModifyAction> operation, final Optional<CompositeNode> lastChildOverride) {
final CompositeNodeBuilder<ImmutableCompositeNode> builder = ImmutableCompositeNode.builder();
builder.setQName(arg.getNodeType());
return builder.toInstance();
}
- private String modifyOperationToXmlString(final ModifyAction operation) {
- return operation.name().toLowerCase();
- }
+ private CompositeNode createEditConfigRequest(final CompositeNode editStructure, final Optional<ModifyAction> defaultOperation) {
+ final CompositeNodeBuilder<ImmutableCompositeNode> ret = ImmutableCompositeNode.builder();
- /**
- * Send commit rpc to finish the transaction
- * In case of failure or unexpected error response, ExecutionException is thrown
- */
- @Override
- public RpcResult<Void> finish() {
- try {
- final RpcResult<?> rpcResult = rpc.invokeRpc(NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME, getCommitRequest()).get();
- return new RpcResultVoidWrapper(rpcResult);
- } catch (final InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new RuntimeException(id + ": Interrupted while waiting for response", e);
- } catch (final ExecutionException e) {
- LOG.warn("{}: Failed to finish commit operation", id, e);
- return RpcResultBuilder.<Void>failed().withError( RpcError.ErrorType.APPLICATION,
- id + ": Unexpected operation error during commit operation", e ).build();
+ // Target
+ final Node<?> targetWrapperNode = ImmutableCompositeNode.create(NETCONF_TARGET_QNAME, ImmutableList.<Node<?>>of(targetNode));
+ ret.add(targetWrapperNode);
+
+ // Default operation
+ if(defaultOperation.isPresent()) {
+ final SimpleNode<String> defOp = NodeFactory.createImmutableSimpleNode(NETCONF_DEFAULT_OPERATION_QNAME, null, modifyOperationToXmlString(defaultOperation.get()));
+ ret.add(defOp);
}
- }
- private ImmutableCompositeNode getCommitRequest() {
- final CompositeNodeBuilder<ImmutableCompositeNode> commitInput = ImmutableCompositeNode.builder();
- commitInput.setQName(NETCONF_COMMIT_QNAME);
- return commitInput.toInstance();
- }
+ // Error option
+ if(rollbackSupported) {
+ ret.addLeaf(NETCONF_ERROR_OPTION_QNAME, ROLLBACK_ON_ERROR_OPTION);
+ }
- @Override
- public DataModification<InstanceIdentifier, CompositeNode> getModification() {
- return this.modification;
+ ret.setQName(NETCONF_EDIT_CONFIG_QNAME);
+ // Edit content
+ ret.add(editStructure);
+ return ret.toInstance();
}
- @Override
- public RpcResult<Void> rollback() throws IllegalStateException {
- // TODO BUG-732 implement rollback by sending discard changes
- return null;
+ private String modifyOperationToXmlString(final ModifyAction operation) {
+ return operation.name().toLowerCase();
}
public CompositeNode getTargetNode(final boolean candidateSupported) {
}
}
- private static final class RpcResultVoidWrapper implements RpcResult<Void> {
-
- private final RpcResult<?> rpcResult;
-
- public RpcResultVoidWrapper(final RpcResult<?> rpcResult) {
- this.rpcResult = rpcResult;
- }
-
- @Override
- public boolean isSuccessful() {
- return rpcResult.isSuccessful();
- }
+ private ImmutableCompositeNode getCommitRequest() {
+ final CompositeNodeBuilder<ImmutableCompositeNode> commitInput = ImmutableCompositeNode.builder();
+ commitInput.setQName(NETCONF_COMMIT_QNAME);
+ return commitInput.toInstance();
+ }
- @Override
- public Void getResult() {
- return null;
- }
- @Override
- public Collection<RpcError> getErrors() {
- return rpcResult.getErrors();
- }
+ @Override
+ public Object getIdentifier() {
+ return this;
}
}
import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
.create("urn:ietf:params:netconf:capability:rollback-on-error:1.0");
public static String ROLLBACK_ON_ERROR_OPTION = "rollback-on-error";
- public static Node<?> toFilterStructure(final InstanceIdentifier identifier) {
+ public static Node<?> toFilterStructure(final YangInstanceIdentifier identifier) {
Node<?> previous = null;
if (Iterables.isEmpty(identifier.getPathArguments())) {
return null;
}
- for (final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument component : identifier.getReversePathArguments()) {
- if (component instanceof InstanceIdentifier.NodeIdentifierWithPredicates) {
- previous = toNode((InstanceIdentifier.NodeIdentifierWithPredicates)component, previous);
+ for (final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument component : identifier.getReversePathArguments()) {
+ if (component instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
+ previous = toNode((YangInstanceIdentifier.NodeIdentifierWithPredicates)component, previous);
} else {
previous = toNode(component, previous);
}
return filter("subtree", previous);
}
- static Node<?> toNode(final InstanceIdentifier.NodeIdentifierWithPredicates argument, final Node<?> node) {
+ static Node<?> toNode(final YangInstanceIdentifier.NodeIdentifierWithPredicates argument, final Node<?> node) {
final List<Node<?>> list = new ArrayList<>();
for (final Map.Entry<QName, Object> arg : argument.getKeyValues().entrySet()) {
list.add(new SimpleNodeTOImpl(arg.getKey(), null, arg.getValue()));
return input;
}
- static Node<?> toNode(final InstanceIdentifier.PathArgument argument, final Node<?> node) {
+ static Node<?> toNode(final YangInstanceIdentifier.PathArgument argument, final Node<?> node) {
if (node != null) {
return new CompositeNodeTOImpl(argument.getNodeType(), null, Collections.<Node<?>> singletonList(node));
} else {
public class RemoteDeviceId {
private final String name;
- private final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path;
+ private final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path;
private final InstanceIdentifier<Node> bindingPath;
private final NodeKey key;
return InstanceIdentifier.builder(Nodes.class).child(Node.class, key).build();
}
- private static org.opendaylight.yangtools.yang.data.api.InstanceIdentifier createBIPath(final String name) {
- final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder builder =
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder();
+ private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBIPath(final String name) {
+ final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder builder =
+ org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder();
builder.node(Nodes.QNAME).nodeWithKey(Node.QNAME, QName.create(Node.QNAME.getNamespace(), Node.QNAME.getRevision(), "id"), name);
return builder.build();
return bindingPath;
}
- public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier getPath() {
+ public org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier getPath() {
return path;
}
<packaging>bundle</packaging>
<dependencies>
+ <dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-binding</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-model-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-model-util</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-parser-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>1.5</version>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-binding</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-akka-raft</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
#to remove trailing spaces in the code files
find src/main/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
+
+#to remove trailing spaces in the generated code on OSX
+find src/main/java -type f -print0 |xargs -0 perl -pi -e 's/ +$//'
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * NormalizedNodeBuilder is a builder that walks through a tree like structure and constructs a
+ * NormalizedNode from it.
+ * <p/>
+ * A large part of this code has been copied over from a similar class in sal-common-impl which was
+ * originally supposed to convert a CompositeNode to NormalizedNode
+ *
+ * @param <T>
+ */
+public abstract class NodeToNormalizedNodeBuilder<T extends PathArgument>
+ implements Identifiable<T> {
+
+ private final T identifier;
+
+ protected static final Logger logger = LoggerFactory
+ .getLogger(NodeToNormalizedNodeBuilder.class);
+
+ @Override
+ public T getIdentifier() {
+ return identifier;
+ }
+
+ ;
+
+ protected NodeToNormalizedNodeBuilder(final T identifier) {
+ super();
+ this.identifier = identifier;
+
+ }
+
+ /**
+ * @return Should return true if the node that this operation corresponds to is a mixin
+ */
+ public boolean isMixin() {
+ return false;
+ }
+
+
+ /**
+ * @return Should return true if the node that this operation corresponds to has a 'key'
+ * associated with it. This is typically true for a list-item or leaf-list entry in yang
+ */
+ public boolean isKeyedEntry() {
+ return false;
+ }
+
+ protected Set<QName> getQNameIdentifiers() {
+ return Collections.singleton(identifier.getNodeType());
+ }
+
+ public abstract NodeToNormalizedNodeBuilder<?> getChild(
+ final PathArgument child);
+
+ public abstract NodeToNormalizedNodeBuilder<?> getChild(QName child);
+
+ public abstract NormalizedNode<?, ?> normalize(QName nodeType, Node node);
+
+
+
+ private static abstract class SimpleTypeNormalization<T extends PathArgument>
+ extends NodeToNormalizedNodeBuilder<T> {
+
+ protected SimpleTypeNormalization(final T identifier) {
+ super(identifier);
+ }
+
+ @Override
+ public NormalizedNode<?, ?> normalize(final QName nodeType,
+ final Node node) {
+ checkArgument(node != null);
+ return normalizeImpl(nodeType, node);
+ }
+
+ protected abstract NormalizedNode<?, ?> normalizeImpl(QName nodeType,
+ Node node);
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(
+ final PathArgument child) {
+ return null;
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+ return null;
+ }
+
+ @Override
+ public NormalizedNode<?, ?> createDefault(
+ final PathArgument currentArg) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+
+
+ private static final class LeafNormalization extends
+ SimpleTypeNormalization<NodeIdentifier> {
+
+ private final LeafSchemaNode schema;
+
+ protected LeafNormalization(final LeafSchemaNode schema, final NodeIdentifier identifier) {
+ super(identifier);
+ this.schema = schema;
+ }
+
+ @Override
+ protected NormalizedNode<?, ?> normalizeImpl(final QName nodeType,
+ final Node node) {
+ Object value = NodeValueCodec.toTypeSafeValue(this.schema, this.schema.getType(), node);
+ return ImmutableNodes.leafNode(nodeType, value);
+
+ }
+
+ }
+
+
+ private static final class LeafListEntryNormalization extends
+ SimpleTypeNormalization<NodeWithValue> {
+
+ private final LeafListSchemaNode schema;
+
+ public LeafListEntryNormalization(final LeafListSchemaNode potential) {
+ super(new NodeWithValue(potential.getQName(), null));
+ this.schema = potential;
+ }
+
+ @Override
+ protected NormalizedNode<?, ?> normalizeImpl(final QName nodeType,
+ final Node node) {
+ final Object data = node.getValue();
+ if (data == null) {
+ Preconditions.checkArgument(false,
+ "No data available in leaf list entry for " + nodeType);
+ }
+
+ Object value = NodeValueCodec.toTypeSafeValue(this.schema, this.schema.getType(), node);
+
+ NodeWithValue nodeId = new NodeWithValue(nodeType, value);
+ return Builders.leafSetEntryBuilder().withNodeIdentifier(nodeId)
+ .withValue(value).build();
+ }
+
+
+ @Override
+ public boolean isKeyedEntry() {
+ return true;
+ }
+ }
+
+
+ private static abstract class NodeToNormalizationNodeOperation<T extends PathArgument>
+ extends NodeToNormalizedNodeBuilder<T> {
+
+ protected NodeToNormalizationNodeOperation(final T identifier) {
+ super(identifier);
+ }
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ @Override
+ public final NormalizedNodeContainer<?, ?, ?> normalize(
+ final QName nodeType, final Node node) {
+ checkArgument(node != null);
+
+ if (!node.getType().equals(AugmentationNode.class.getSimpleName())
+ && !node.getType().equals(ContainerNode.class.getSimpleName())
+ && !node.getType().equals(MapNode.class.getSimpleName())) {
+ checkArgument(nodeType != null);
+ }
+
+ NormalizedNodeContainerBuilder builder = createBuilder(node);
+
+ Set<NodeToNormalizedNodeBuilder<?>> usedMixins = new HashSet<>();
+
+ logNode(node);
+
+ if (node.getChildCount() == 0 && (
+ node.getType().equals(LeafSetEntryNode.class.getSimpleName())
+ || node.getType().equals(LeafNode.class.getSimpleName()))) {
+ PathArgument childPathArgument =
+ NodeIdentifierFactory.getArgument(node.getPath());
+
+ final NormalizedNode child;
+ if (childPathArgument instanceof NodeWithValue) {
+ final NodeWithValue nodeWithValue =
+ new NodeWithValue(childPathArgument.getNodeType(),
+ node.getValue());
+ child =
+ Builders.leafSetEntryBuilder()
+ .withNodeIdentifier(nodeWithValue)
+ .withValue(node.getValue()).build();
+ } else {
+ child =
+ ImmutableNodes.leafNode(childPathArgument.getNodeType(),
+ node.getValue());
+ }
+ builder.addChild(child);
+ }
+
+ final List<Node> children = node.getChildList();
+ for (Node nodeChild : children) {
+
+ PathArgument childPathArgument =
+ NodeIdentifierFactory.getArgument(nodeChild.getPath());
+
+ QName childNodeType = null;
+ NodeToNormalizedNodeBuilder childOp = null;
+
+ if (childPathArgument instanceof AugmentationIdentifier) {
+ childOp = getChild(childPathArgument);
+ checkArgument(childOp instanceof AugmentationNormalization, childPathArgument);
+ } else {
+ childNodeType = childPathArgument.getNodeType();
+ childOp = getChild(childNodeType);
+ }
+ // We skip unknown nodes if this node is mixin since
+ // it's nodes and parent nodes are interleaved
+ if (childOp == null && isMixin()) {
+ continue;
+ } else if (childOp == null) {
+ logger.error(
+ "childOp is null and this operation is not a mixin : this = {}",
+ this.toString());
+ }
+
+ checkArgument(childOp != null,
+ "Node %s is not allowed inside %s",
+ childNodeType, getIdentifier());
+
+ if (childOp.isMixin()) {
+ if (usedMixins.contains(childOp)) {
+ // We already run / processed that mixin, so to avoid
+ // duplicate we are
+ // skipping next nodes.
+ continue;
+ }
+ // builder.addChild(childOp.normalize(nodeType, treeCacheNode));
+ final NormalizedNode childNode =
+ childOp.normalize(childNodeType, nodeChild);
+ if (childNode != null)
+ builder.addChild(childNode);
+ usedMixins.add(childOp);
+ } else {
+ final NormalizedNode childNode =
+ childOp.normalize(childNodeType, nodeChild);
+ if (childNode != null)
+ builder.addChild(childNode);
+ }
+ }
+
+
+ try {
+ return (NormalizedNodeContainer<?, ?, ?>) builder.build();
+ } catch (Exception e) {
+ return null;
+ }
+
+ }
+
+ private void logNode(Node node) {
+ //let us find out the type of the node
+ logger.debug("We got a {} , with identifier {} with {} children",
+ node.getType(), node.getPath(),
+ node.getChildList());
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected abstract NormalizedNodeContainerBuilder createBuilder(
+ final Node node);
+
+ }
+
+
+ private static abstract class DataContainerNormalizationOperation<T extends PathArgument>
+ extends NodeToNormalizationNodeOperation<T> {
+
+ private final DataNodeContainer schema;
+ private final Map<QName, NodeToNormalizedNodeBuilder<?>> byQName;
+ private final Map<PathArgument, NodeToNormalizedNodeBuilder<?>> byArg;
+
+ protected DataContainerNormalizationOperation(final T identifier,
+ final DataNodeContainer schema) {
+ super(identifier);
+ this.schema = schema;
+ this.byArg = new ConcurrentHashMap<>();
+ this.byQName = new ConcurrentHashMap<>();
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(
+ final PathArgument child) {
+ NodeToNormalizedNodeBuilder<?> potential = byArg.get(child);
+ if (potential != null) {
+ return potential;
+ }
+ potential = fromSchema(schema, child);
+ return register(potential);
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+ if (child == null) {
+ return null;
+ }
+
+ NodeToNormalizedNodeBuilder<?> potential = byQName.get(child);
+ if (potential != null) {
+ return potential;
+ }
+ potential = fromSchemaAndPathArgument(schema, child);
+ return register(potential);
+ }
+
+ private NodeToNormalizedNodeBuilder<?> register(
+ final NodeToNormalizedNodeBuilder<?> potential) {
+ if (potential != null) {
+ byArg.put(potential.getIdentifier(), potential);
+ for (QName qName : potential.getQNameIdentifiers()) {
+ byQName.put(qName, potential);
+ }
+ }
+ return potential;
+ }
+
+ }
+
+
+ private static final class ListItemNormalization extends
+ DataContainerNormalizationOperation<NodeIdentifierWithPredicates> {
+
+ private final List<QName> keyDefinition;
+ private final ListSchemaNode schemaNode;
+
+ protected ListItemNormalization(
+ final NodeIdentifierWithPredicates identifier,
+ final ListSchemaNode schema) {
+ super(identifier, schema);
+ this.schemaNode = schema;
+ keyDefinition = schema.getKeyDefinition();
+ }
+
+ @Override
+ protected NormalizedNodeContainerBuilder createBuilder(
+ final Node node) {
+ NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
+ (NodeIdentifierWithPredicates) NodeIdentifierFactory
+ .createPathArgument(node
+ .getPath(), schemaNode);
+ return Builders.mapEntryBuilder()
+ .withNodeIdentifier(
+ nodeIdentifierWithPredicates
+ );
+ }
+
+ @Override
+ public NormalizedNode<?, ?> createDefault(
+ final PathArgument currentArg) {
+ DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode>
+ builder =
+ Builders.mapEntryBuilder().withNodeIdentifier(
+ (NodeIdentifierWithPredicates) currentArg);
+ for (Entry<QName, Object> keyValue : ((NodeIdentifierWithPredicates) currentArg)
+ .getKeyValues().entrySet()) {
+ if (keyValue.getValue() == null) {
+ throw new NullPointerException(
+ "Null value found for path : "
+ + currentArg);
+ }
+ builder.addChild(Builders.leafBuilder()
+ //
+ .withNodeIdentifier(new NodeIdentifier(keyValue.getKey()))
+ .withValue(keyValue.getValue()).build());
+ }
+ return builder.build();
+ }
+
+
+ @Override
+ public boolean isKeyedEntry() {
+ return true;
+ }
+ }
+
+
+ private static final class ContainerNormalization extends
+ DataContainerNormalizationOperation<NodeIdentifier> {
+
+ protected ContainerNormalization(final ContainerSchemaNode schema) {
+ super(new NodeIdentifier(schema.getQName()), schema);
+ }
+
+ @Override
+ protected NormalizedNodeContainerBuilder createBuilder(
+ final Node node) {
+ return Builders.containerBuilder()
+ .withNodeIdentifier(getIdentifier());
+ }
+
+ @Override
+ public NormalizedNode<?, ?> createDefault(
+ final PathArgument currentArg) {
+ return Builders.containerBuilder()
+ .withNodeIdentifier((NodeIdentifier) currentArg).build();
+ }
+
+ }
+
+
+ private static abstract class MixinNormalizationOp<T extends PathArgument>
+ extends NodeToNormalizationNodeOperation<T> {
+
+ protected MixinNormalizationOp(final T identifier) {
+ super(identifier);
+ }
+
+ @Override
+ public final boolean isMixin() {
+ return true;
+ }
+
+ }
+
+
+ private static final class LeafListMixinNormalization extends
+ MixinNormalizationOp<NodeIdentifier> {
+
+ private final NodeToNormalizedNodeBuilder<?> innerOp;
+
+ public LeafListMixinNormalization(final LeafListSchemaNode potential) {
+ super(new NodeIdentifier(potential.getQName()));
+ innerOp = new LeafListEntryNormalization(potential);
+ }
+
+ @Override
+ protected NormalizedNodeContainerBuilder createBuilder(
+ final Node node) {
+ return Builders.leafSetBuilder()
+ .withNodeIdentifier(getIdentifier());
+ }
+
+ @Override
+ public NormalizedNode<?, ?> createDefault(
+ final PathArgument currentArg) {
+ return Builders.leafSetBuilder().withNodeIdentifier(getIdentifier())
+ .build();
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(
+ final PathArgument child) {
+ if (child instanceof NodeWithValue) {
+ return innerOp;
+ }
+ return null;
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+ if (getIdentifier().getNodeType().equals(child)) {
+ return innerOp;
+ }
+ return null;
+ }
+
+ }
+
+
+ private static final class AugmentationNormalization extends
+ MixinNormalizationOp<AugmentationIdentifier> {
+
+ private final Map<QName, NodeToNormalizedNodeBuilder<?>> byQName;
+ private final Map<PathArgument, NodeToNormalizedNodeBuilder<?>> byArg;
+
+ public AugmentationNormalization(final AugmentationSchema augmentation,
+ final DataNodeContainer schema) {
+ super(augmentationIdentifierFrom(augmentation));
+
+ ImmutableMap.Builder<QName, NodeToNormalizedNodeBuilder<?>>
+ byQNameBuilder =
+ ImmutableMap.builder();
+ ImmutableMap.Builder<PathArgument, NodeToNormalizedNodeBuilder<?>>
+ byArgBuilder =
+ ImmutableMap.builder();
+
+ for (DataSchemaNode augNode : augmentation.getChildNodes()) {
+ DataSchemaNode resolvedNode =
+ schema.getDataChildByName(augNode.getQName());
+ NodeToNormalizedNodeBuilder<?> resolvedOp =
+ fromDataSchemaNode(resolvedNode);
+ byArgBuilder.put(resolvedOp.getIdentifier(), resolvedOp);
+ for (QName resQName : resolvedOp.getQNameIdentifiers()) {
+ byQNameBuilder.put(resQName, resolvedOp);
+ }
+ }
+ byQName = byQNameBuilder.build();
+ byArg = byArgBuilder.build();
+
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(
+ final PathArgument child) {
+ return byArg.get(child);
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+ return byQName.get(child);
+ }
+
+ @Override
+ protected Set<QName> getQNameIdentifiers() {
+ return getIdentifier().getPossibleChildNames();
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ protected NormalizedNodeContainerBuilder createBuilder(
+ final Node node) {
+ return Builders.augmentationBuilder()
+ .withNodeIdentifier(getIdentifier());
+ }
+
+ @Override
+ public NormalizedNode<?, ?> createDefault(
+ final PathArgument currentArg) {
+ return Builders.augmentationBuilder()
+ .withNodeIdentifier(getIdentifier())
+ .build();
+ }
+
+ }
+
+
+ private static final class ListMixinNormalization extends
+ MixinNormalizationOp<NodeIdentifier> {
+
+ private final ListItemNormalization innerNode;
+
+ public ListMixinNormalization(final ListSchemaNode list) {
+ super(new NodeIdentifier(list.getQName()));
+ this.innerNode =
+ new ListItemNormalization(new NodeIdentifierWithPredicates(
+ list.getQName(), Collections.<QName, Object>emptyMap()),
+ list);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ protected NormalizedNodeContainerBuilder createBuilder(
+ final Node node) {
+ return Builders.mapBuilder().withNodeIdentifier(getIdentifier());
+ }
+
+ @Override
+ public NormalizedNode<?, ?> createDefault(
+ final PathArgument currentArg) {
+ return Builders.mapBuilder().withNodeIdentifier(getIdentifier())
+ .build();
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(
+ final PathArgument child) {
+ if (child.getNodeType().equals(getIdentifier().getNodeType())) {
+ return innerNode;
+ }
+ return null;
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+ if (getIdentifier().getNodeType().equals(child)) {
+ return innerNode;
+ }
+ return null;
+ }
+
+ }
+
+
+ private static class ChoiceNodeNormalization extends
+ MixinNormalizationOp<NodeIdentifier> {
+
+ private final ImmutableMap<QName, NodeToNormalizedNodeBuilder<?>>
+ byQName;
+ private final ImmutableMap<PathArgument, NodeToNormalizedNodeBuilder<?>>
+ byArg;
+
+ protected ChoiceNodeNormalization(
+ final org.opendaylight.yangtools.yang.model.api.ChoiceNode schema) {
+ super(new NodeIdentifier(schema.getQName()));
+ ImmutableMap.Builder<QName, NodeToNormalizedNodeBuilder<?>>
+ byQNameBuilder =
+ ImmutableMap.builder();
+ ImmutableMap.Builder<PathArgument, NodeToNormalizedNodeBuilder<?>>
+ byArgBuilder =
+ ImmutableMap.builder();
+
+ for (ChoiceCaseNode caze : schema.getCases()) {
+ for (DataSchemaNode cazeChild : caze.getChildNodes()) {
+ NodeToNormalizedNodeBuilder<?> childOp =
+ fromDataSchemaNode(cazeChild);
+ byArgBuilder.put(childOp.getIdentifier(), childOp);
+ for (QName qname : childOp.getQNameIdentifiers()) {
+ byQNameBuilder.put(qname, childOp);
+ }
+ }
+ }
+ byQName = byQNameBuilder.build();
+ byArg = byArgBuilder.build();
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(
+ final PathArgument child) {
+ return byArg.get(child);
+ }
+
+ @Override
+ public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+ return byQName.get(child);
+ }
+
+ @Override
+ protected NormalizedNodeContainerBuilder createBuilder(
+ final Node node) {
+ return Builders.choiceBuilder().withNodeIdentifier(getIdentifier());
+ }
+
+ @Override
+ public NormalizedNode<?, ?> createDefault(
+ final PathArgument currentArg) {
+ return Builders.choiceBuilder().withNodeIdentifier(getIdentifier())
+ .build();
+ }
+ }
+
+ /**
+ * Find an appropriate NormalizedNodeBuilder using both the schema and the
+ * Path Argument
+ *
+ * @param schema
+ * @param child
+ * @return
+ */
+ public static NodeToNormalizedNodeBuilder<?> fromSchemaAndPathArgument(
+ final DataNodeContainer schema, final QName child) {
+ DataSchemaNode potential = schema.getDataChildByName(child);
+ if (potential == null) {
+ Iterable<org.opendaylight.yangtools.yang.model.api.ChoiceNode>
+ choices =
+ FluentIterable.from(schema.getChildNodes()).filter(
+ org.opendaylight.yangtools.yang.model.api.ChoiceNode.class);
+ potential = findChoice(choices, child);
+ }
+ if (potential == null) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("BAD CHILD = {}", child.toString());
+ }
+ }
+
+ checkArgument(potential != null,
+ "Supplied QName %s is not valid according to schema %s", child,
+ schema);
+
+ // If the schema in an instance of DataSchemaNode and the potential
+ // is augmenting something then there is a chance that this may be
+ // and augmentation node
+ if ((schema instanceof DataSchemaNode)
+ && potential.isAugmenting()) {
+
+ AugmentationNormalization augmentation =
+ fromAugmentation(schema, (AugmentationTarget) schema,
+ potential);
+
+ // If an augmentation normalization (builder) is not found then
+ // we fall through to the regular processing
+ if(augmentation != null){
+ return augmentation;
+ }
+ }
+ return fromDataSchemaNode(potential);
+ }
+
+ /**
+ * Given a bunch of choice nodes and a the name of child find a choice node for that child which
+ * has a non-null value
+ *
+ * @param choices
+ * @param child
+ * @return
+ */
+ private static org.opendaylight.yangtools.yang.model.api.ChoiceNode findChoice(
+ final Iterable<org.opendaylight.yangtools.yang.model.api.ChoiceNode> choices,
+ final QName child) {
+ org.opendaylight.yangtools.yang.model.api.ChoiceNode foundChoice = null;
+ choiceLoop:
+ for (org.opendaylight.yangtools.yang.model.api.ChoiceNode choice : choices) {
+ for (ChoiceCaseNode caze : choice.getCases()) {
+ if (caze.getDataChildByName(child) != null) {
+ foundChoice = choice;
+ break choiceLoop;
+ }
+ }
+ }
+ return foundChoice;
+ }
+
+
+ /**
+ * Create an AugmentationIdentifier based on the AugmentationSchema
+ *
+ * @param augmentation
+ * @return
+ */
+ public static AugmentationIdentifier augmentationIdentifierFrom(
+ final AugmentationSchema augmentation) {
+ ImmutableSet.Builder<QName> potentialChildren = ImmutableSet.builder();
+ for (DataSchemaNode child : augmentation.getChildNodes()) {
+ potentialChildren.add(child.getQName());
+ }
+ return new AugmentationIdentifier(potentialChildren.build());
+ }
+
+ /**
+ * Create an AugmentationNormalization based on the schema of the DataContainer, the
+ * AugmentationTarget and the potential schema node
+ *
+ * @param schema
+ * @param augments
+ * @param potential
+ * @return
+ */
+ private static AugmentationNormalization fromAugmentation(
+ final DataNodeContainer schema, final AugmentationTarget augments,
+ final DataSchemaNode potential) {
+ AugmentationSchema augmentation = null;
+ for (AugmentationSchema aug : augments.getAvailableAugmentations()) {
+ DataSchemaNode child = aug.getDataChildByName(potential.getQName());
+ if (child != null) {
+ augmentation = aug;
+ break;
+ }
+
+ }
+ if (augmentation != null) {
+ return new AugmentationNormalization(augmentation, schema);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @param schema
+ * @param child
+ * @return
+ */
+ private static NodeToNormalizedNodeBuilder<?> fromSchema(
+ final DataNodeContainer schema, final PathArgument child) {
+ if (child instanceof AugmentationIdentifier) {
+ QName childQName = ((AugmentationIdentifier) child)
+ .getPossibleChildNames().iterator().next();
+
+ return fromSchemaAndPathArgument(schema, childQName);
+ }
+ return fromSchemaAndPathArgument(schema, child.getNodeType());
+ }
+
+ public static NodeToNormalizedNodeBuilder<?> fromDataSchemaNode(
+ final DataSchemaNode potential) {
+ if (potential instanceof ContainerSchemaNode) {
+ return new ContainerNormalization((ContainerSchemaNode) potential);
+ } else if (potential instanceof ListSchemaNode) {
+ return new ListMixinNormalization((ListSchemaNode) potential);
+ } else if (potential instanceof LeafSchemaNode) {
+ return new LeafNormalization((LeafSchemaNode) potential,
+ new NodeIdentifier(potential.getQName()));
+ } else if (potential instanceof org.opendaylight.yangtools.yang.model.api.ChoiceNode) {
+ return new ChoiceNodeNormalization(
+ (org.opendaylight.yangtools.yang.model.api.ChoiceNode) potential);
+ } else if (potential instanceof LeafListSchemaNode) {
+ return new LeafListMixinNormalization(
+ (LeafListSchemaNode) potential);
+ }
+ return null;
+ }
+
+ public static NodeToNormalizedNodeBuilder<?> from(final SchemaContext ctx) {
+ return new ContainerNormalization(ctx);
+ }
+
+ public abstract NormalizedNode<?, ?> createDefault(PathArgument currentArg);
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.node;
+
+import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
+import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.codec.BitsCodec;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.util.IdentityrefType;
+import org.opendaylight.yangtools.yang.model.util.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.util.Leafref;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NodeValueCodec {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(NodeValueCodec.class);
+
+ public static Object toTypeSafeValue(DataSchemaNode schema, TypeDefinition type, NormalizedNodeMessages.Node node){
+
+ String value = node.getValue();
+
+ if(schema != null && value != null){
+ TypeDefinition<?> baseType = type;
+
+ while (baseType.getBaseType() != null) {
+ baseType = baseType.getBaseType();
+ }
+
+ TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codec =
+ TypeDefinitionAwareCodec.from(type);
+
+ if(codec instanceof BitsCodec){
+ if(value.contains("[]")){
+ value = "";
+ } else {
+ value = value.replace("[", "");
+ value = value.replace("]", "");
+ value = value.replace(",", " ");
+ }
+ }
+
+ if (codec != null) {
+ return codec.deserialize(value);
+ } else if(baseType instanceof Leafref) {
+ return value;
+ } else if(baseType instanceof IdentityrefType) {
+ return QNameFactory.create(value);
+ } else if(baseType instanceof InstanceIdentifier) {
+ return InstanceIdentifierUtils.fromSerializable(node.getInstanceIdentifierValue());
+ } else {
+ logger.error("Could not figure out how to transform value " + value + " for schemaType " + type);
+ }
+ }
+
+ return value;
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node;
+
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.cluster.datastore.node.utils.PathUtils;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NormalizedNodeToNodeCodec {
+ private final SchemaContext ctx;
+ private static final Logger logger = LoggerFactory.getLogger(NormalizedNodeToNodeCodec.class);
+
+ public NormalizedNodeToNodeCodec(final SchemaContext ctx){
+ this.ctx = ctx;
+
+ }
+
+ public NormalizedNodeMessages.Container encode(YangInstanceIdentifier id, NormalizedNode node){
+ String parentPath = "";
+
+ if(id != null){
+ parentPath = PathUtils.getParentPath(id.toString());
+ }
+
+
+ NormalizedNodeToProtocolBufferNode encoder = new NormalizedNodeToProtocolBufferNode();
+ encoder.encode(parentPath, node);
+
+ return encoder.getContainer();
+
+
+ }
+
+ public NormalizedNode<?,?> decode(YangInstanceIdentifier id, NormalizedNodeMessages.Node node){
+ NodeToNormalizedNodeBuilder currentOp = NodeToNormalizedNodeBuilder.from(ctx);
+
+ for(YangInstanceIdentifier.PathArgument pathArgument : id.getPathArguments()){
+ currentOp = currentOp.getChild(pathArgument);
+ }
+
+ QName nodeType = null;
+
+ if(id.getPath().size() < 1){
+ nodeType = null;
+ } else {
+ final YangInstanceIdentifier.PathArgument pathArgument = id.getPath().get(id.getPath().size() - 1);
+ if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){
+ nodeType = null;
+ } else {
+ nodeType = pathArgument.getNodeType();
+ }
+ }
+ if((node != null)&& (!node.getType().isEmpty())){
+ return currentOp.normalize(nodeType, node);
+ } else{
+ return null;
+ }
+ }
+
+
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+
+import java.util.Map;
+
+/**
+ * NormalizedNodeToProtocolBufferNode walks the NormalizedNode tree converting it to the
+ * NormalizedMessage.Node
+ * <p/>
+ * {@link org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode } is a tree like structure that provides a generic structure for a yang data
+ * model
+ */
+public class NormalizedNodeToProtocolBufferNode {
+
+
+ private final Node.Builder builderRoot;
+ private NormalizedNodeMessages.Container container;
+
+ public NormalizedNodeToProtocolBufferNode() {
+
+ builderRoot = Node.newBuilder();
+ }
+
+ public void encode(String parentPath, NormalizedNode<?, ?> normalizedNode) {
+ if (parentPath == null) {
+ parentPath = "";
+ }
+
+ NormalizedNodeMessages.Container.Builder containerBuilder =
+ NormalizedNodeMessages.Container.newBuilder();
+
+ if (normalizedNode != null) {
+
+ navigateNormalizedNode(0, parentPath, normalizedNode, builderRoot);
+ // here we need to put back the Node Tree in Container
+
+ container =
+ containerBuilder.setParentPath(parentPath).setNormalizedNode(
+ builderRoot.build()).build();
+ } else {
+ //this can happen when an attempt was made to read from datastore and normalized node was null.
+ container = containerBuilder.setParentPath(parentPath).build();
+
+ }
+
+ }
+
+
+ private void navigateDataContainerNode(int level, final String parentPath,
+ final DataContainerNode<?> dataContainerNode,
+ Node.Builder builderParent) {
+
+ String newParentPath =
+ parentPath + "/" + dataContainerNode.getIdentifier().toString();
+ String type = getDataContainerType(dataContainerNode).getSimpleName();
+ builderParent.setPath(dataContainerNode.getIdentifier().toString())
+ .setType(type);
+
+ final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>>
+ value =
+ dataContainerNode.getValue();
+ for (NormalizedNode<?, ?> node : value) {
+ Node.Builder builderChild = Node.newBuilder();
+ if (node instanceof MixinNode
+ && node instanceof NormalizedNodeContainer) {
+
+ navigateNormalizedNodeContainerMixin(level, newParentPath,
+ (NormalizedNodeContainer<?, ?, ?>) node, builderChild);
+ } else {
+ navigateNormalizedNode(level, newParentPath, node,
+ builderChild);
+ }
+ builderParent.addChild(builderChild);
+ }
+ }
+
+ private Class getDataContainerType(
+ NormalizedNodeContainer<?, ?, ?> dataContainerNode) {
+ if (dataContainerNode instanceof ChoiceNode) {
+ return ChoiceNode.class;
+ } else if (dataContainerNode instanceof AugmentationNode) {
+ return AugmentationNode.class;
+ } else if (dataContainerNode instanceof ContainerNode) {
+ return ContainerNode.class;
+ } else if (dataContainerNode instanceof MapEntryNode) {
+ return MapEntryNode.class;
+ } else if (dataContainerNode instanceof UnkeyedListEntryNode) {
+ return UnkeyedListEntryNode.class;
+ } else if (dataContainerNode instanceof MapNode) {
+ return MapNode.class;
+ } else if (dataContainerNode instanceof LeafSetNode) {
+ return LeafSetNode.class;
+ }
+ throw new IllegalArgumentException(
+ "could not find the data container node type "
+ + dataContainerNode.toString()
+ );
+ }
+
+ private void navigateNormalizedNodeContainerMixin(int level,
+ final String parentPath,
+ NormalizedNodeContainer<?, ?, ?> node, Node.Builder builderParent) {
+ String newParentPath =
+ parentPath + "/" + node.getIdentifier().toString();
+
+ builderParent.setPath(node.getIdentifier().toString()).setType(
+ this.getDataContainerType(node).getSimpleName());
+ final Iterable<? extends NormalizedNode<?, ?>> value = node.getValue();
+ for (NormalizedNode normalizedNode : value) {
+ // child node builder
+ Node.Builder builderChild = Node.newBuilder();
+ if (normalizedNode instanceof MixinNode
+ && normalizedNode instanceof NormalizedNodeContainer) {
+ navigateNormalizedNodeContainerMixin(level + 1, newParentPath,
+ (NormalizedNodeContainer) normalizedNode, builderChild);
+ } else {
+ navigateNormalizedNode(level, newParentPath, normalizedNode,
+ builderChild);
+ }
+ builderParent.addChild(builderChild);
+
+ }
+
+
+
+ }
+
+
+ private void navigateNormalizedNode(int level,
+ String parentPath, NormalizedNode<?, ?> normalizedNode,
+ Node.Builder builderParent) {
+
+ if (normalizedNode instanceof DataContainerNode) {
+
+ final DataContainerNode<?> dataContainerNode =
+ (DataContainerNode) normalizedNode;
+
+ navigateDataContainerNode(level + 1, parentPath, dataContainerNode,
+ builderParent);
+ } else if (normalizedNode instanceof MixinNode
+ && normalizedNode instanceof NormalizedNodeContainer) {
+
+ navigateNormalizedNodeContainerMixin(level, parentPath,
+ (NormalizedNodeContainer<?, ?, ?>) normalizedNode,
+ builderParent);
+ } else {
+ if (normalizedNode instanceof LeafNode) {
+ buildLeafNode(parentPath, normalizedNode, builderParent);
+ } else if (normalizedNode instanceof LeafSetEntryNode) {
+ buildLeafSetEntryNode(parentPath, normalizedNode,
+ builderParent);
+ }
+
+ }
+
+ }
+
+ private void buildLeafSetEntryNode(String parentPath,
+ NormalizedNode<?, ?> normalizedNode,
+ Node.Builder builderParent) {
+ String path =
+ parentPath + "/" + normalizedNode.getIdentifier().toString();
+ LeafSetEntryNode leafSetEntryNode = (LeafSetEntryNode) normalizedNode;
+ Map<QName, String> attributes = leafSetEntryNode.getAttributes();
+ if (!attributes.isEmpty()) {
+ NormalizedNodeMessages.Attribute.Builder builder = null;
+ for (Map.Entry<QName, String> attribute : attributes.entrySet()) {
+ builder = NormalizedNodeMessages.Attribute.newBuilder();
+
+ builder
+ .setName(attribute.getKey().toString())
+ .setValue(normalizedNode.getValue().toString());
+
+ builderParent.addAttributes(builder.build());
+ }
+ }
+ buildNodeValue(normalizedNode, builderParent);
+ }
+
+ private void buildLeafNode(String parentPath,
+ NormalizedNode<?, ?> normalizedNode,
+ Node.Builder builderParent) {
+ Preconditions.checkNotNull(parentPath);
+ Preconditions.checkNotNull(normalizedNode);
+ String path =
+ parentPath + "/" + normalizedNode.getIdentifier().toString();
+ LeafNode leafNode = (LeafNode) normalizedNode;
+ Map<QName, String> attributes = leafNode.getAttributes();
+ if (!attributes.isEmpty()) {
+ NormalizedNodeMessages.Attribute.Builder builder = null;
+ for (Map.Entry<QName, String> attribute : attributes.entrySet()) {
+ builder = NormalizedNodeMessages.Attribute.newBuilder();
+ builder
+ .setName(attribute.getKey().toString())
+ .setValue(attribute.getValue().toString());
+
+ builderParent.addAttributes(builder.build());
+ }
+ }
+
+ Object value = normalizedNode.getValue();
+ if (value == null) {
+ builderParent
+ .setPath(normalizedNode.getIdentifier().toString())
+ .setType(LeafNode.class.getSimpleName())
+ .setValueType(String.class.getSimpleName())
+ .setValue("");
+ } else {
+ buildNodeValue(normalizedNode, builderParent);
+ }
+ }
+
+ private void buildNodeValue(NormalizedNode<?, ?> normalizedNode,
+ Node.Builder builderParent) {
+
+ Object value = normalizedNode.getValue();
+
+ builderParent
+ .setPath(normalizedNode.getIdentifier().toString())
+ .setType(LeafNode.class.getSimpleName())
+ .setValueType((value.getClass().getSimpleName()))
+ .setValue(value.toString());
+
+ if(value.getClass().equals(YangInstanceIdentifier.class)){
+ builderParent.setInstanceIdentifierValue(
+ InstanceIdentifierUtils
+ .toSerializable((YangInstanceIdentifier) value));
+ }
+ }
+
+ public NormalizedNodeMessages.Container getContainer() {
+ return container;
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AugmentationIdentifierGenerator {
+ private final String id;
+ private static final Pattern pattern = Pattern.compile("AugmentationIdentifier\\Q{\\EchildNames=\\Q[\\E(.*)\\Q]}\\E");
+ private final Matcher matcher;
+ private final boolean doesMatch;
+
+ public AugmentationIdentifierGenerator(String id){
+ this.id = id;
+ matcher = pattern.matcher(this.id);
+ doesMatch = matcher.matches();
+ }
+
+ public boolean matches(){
+ return doesMatch;
+ }
+
+ public YangInstanceIdentifier.AugmentationIdentifier getPathArgument(){
+ Set<QName> childNames = new HashSet<QName>();
+ final String childQNames = matcher.group(1);
+
+ final String[] splitChildQNames = childQNames.split(",");
+
+ for(String name : splitChildQNames){
+ childNames.add(
+ org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory
+ .create(name.trim()));
+ }
+
+ return new YangInstanceIdentifier.AugmentationIdentifier(null, childNames);
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class NodeIdentifierFactory {
+ private static final Map<String, YangInstanceIdentifier.PathArgument> cache = new HashMap<>();
+ public static YangInstanceIdentifier.PathArgument getArgument(String id){
+ YangInstanceIdentifier.PathArgument value = cache.get(id);
+ if(value == null){
+ synchronized (cache){
+ value = cache.get(id);
+ if(value == null) {
+ value = createPathArgument(id, null);
+ cache.put(id, value);
+ }
+ }
+ }
+ return value;
+ }
+
+ public static YangInstanceIdentifier.PathArgument getArgument(String id, DataSchemaNode schemaNode){
+ YangInstanceIdentifier.PathArgument value = cache.get(id);
+ if(value == null){
+ synchronized (cache){
+ value = cache.get(id);
+ if(value == null) {
+ value = createPathArgument(id, schemaNode);
+ cache.put(id, value);
+ }
+ }
+ }
+ return value;
+ }
+
+ public static YangInstanceIdentifier.PathArgument createPathArgument(String id, DataSchemaNode schemaNode){
+ final NodeIdentifierWithPredicatesGenerator
+ nodeIdentifierWithPredicatesGenerator = new NodeIdentifierWithPredicatesGenerator(id, schemaNode);
+ if(nodeIdentifierWithPredicatesGenerator.matches()){
+ return nodeIdentifierWithPredicatesGenerator.getPathArgument();
+ }
+
+ final NodeIdentifierWithValueGenerator
+ nodeWithValueGenerator = new NodeIdentifierWithValueGenerator(id, schemaNode);
+ if(nodeWithValueGenerator.matches()){
+ return nodeWithValueGenerator.getPathArgument();
+ }
+
+ final AugmentationIdentifierGenerator augmentationIdentifierGenerator = new AugmentationIdentifierGenerator(id);
+ if(augmentationIdentifierGenerator.matches()){
+ return augmentationIdentifierGenerator.getPathArgument();
+ }
+
+ return new NodeIdentifierGenerator(id).getArgument();
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class NodeIdentifierGenerator {
+ private final String id;
+ private final QName qName;
+
+ public NodeIdentifierGenerator(String id){
+ this.id = id;
+ this.qName = QNameFactory.create(id);
+ }
+
+ public YangInstanceIdentifier.PathArgument getArgument(){
+ return new YangInstanceIdentifier.NodeIdentifier(qName);
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class NodeIdentifierWithPredicatesGenerator{
+ private final String id;
+ private static final Pattern pattern = Pattern.compile("(.*)\\Q[{\\E(.*)\\Q}]\\E");
+ private final Matcher matcher;
+ private final boolean doesMatch;
+ private final ListSchemaNode listSchemaNode;
+
+ public NodeIdentifierWithPredicatesGenerator(String id, DataSchemaNode schemaNode){
+ this.id = id;
+ matcher = pattern.matcher(this.id);
+ doesMatch = matcher.matches();
+
+ if(schemaNode instanceof ListSchemaNode){
+ this.listSchemaNode = (ListSchemaNode) schemaNode;
+ } else {
+ this.listSchemaNode = null;
+ }
+ }
+
+
+ public boolean matches(){
+ return doesMatch;
+ }
+
+ public YangInstanceIdentifier.NodeIdentifierWithPredicates getPathArgument(){
+ final String group = matcher.group(2);
+ final String[] keyValues = group.split(",");
+ Map<QName, Object> nameValues = new HashMap<>();
+
+ for(String keyValue : keyValues){
+ int eqIndex = keyValue.lastIndexOf('=');
+ try {
+ final QName key = QNameFactory
+ .create(keyValue.substring(0, eqIndex));
+ nameValues.put(key, getValue(key, keyValue.substring(eqIndex + 1)));
+ } catch(IllegalArgumentException e){
+ System.out.println("Error processing identifier : " + id);
+ throw e;
+ }
+ }
+
+ return new YangInstanceIdentifier.NodeIdentifierWithPredicates(QNameFactory.create(matcher.group(1)), nameValues);
+ }
+
+
+ private Object getValue(QName key, String value){
+ if(listSchemaNode != null){
+ for(DataSchemaNode node : listSchemaNode.getChildNodes()){
+ if(node instanceof LeafSchemaNode && node.getQName().equals(key)){
+ return TypeDefinitionAwareCodec.from(LeafSchemaNode.class.cast(node).getType()).deserialize(value);
+ }
+ }
+ }
+ return value;
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class NodeIdentifierWithValueGenerator{
+ private final String id;
+ private final DataSchemaNode schemaNode;
+ private static final Pattern pattern = Pattern.compile("(.*)\\Q[\\E(.*)\\Q]\\E");
+ private final Matcher matcher;
+ private final boolean doesMatch;
+
+ public NodeIdentifierWithValueGenerator(String id, DataSchemaNode schemaNode){
+ this.id = id;
+ this.schemaNode = schemaNode;
+ matcher = pattern.matcher(this.id);
+ doesMatch = matcher.matches();
+ }
+
+ public boolean matches(){
+ return doesMatch;
+ }
+
+ public YangInstanceIdentifier.PathArgument getPathArgument(){
+ final String name = matcher.group(1);
+ final String value = matcher.group(2);
+
+ return new YangInstanceIdentifier.NodeWithValue(
+ QNameFactory.create(name), getValue(value));
+ }
+
+ private Object getValue(String value){
+ if(schemaNode != null){
+ if(schemaNode instanceof LeafListSchemaNode){
+ return TypeDefinitionAwareCodec
+ .from(LeafListSchemaNode.class.cast(schemaNode).getType()).deserialize(value);
+
+ }
+ }
+ return value;
+ }
+
+ }
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class NormalizedNodeGetter implements
+ NormalizedNodeVisitor {
+ private final String path;
+ NormalizedNode output;
+
+ public NormalizedNodeGetter(String path){
+ Preconditions.checkNotNull(path);
+ this.path = path;
+ }
+
+ @Override
+ public void visitNode(int level, String parentPath, NormalizedNode normalizedNode) {
+ String nodePath = parentPath + "/"+ normalizedNode.getIdentifier().toString();
+
+ if(nodePath.toString().equals(path)){
+ output = normalizedNode;
+ }
+ }
+
+ public NormalizedNode getOutput(){
+ return output;
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
+
+/**
+ * NormalizedNodeNavigator walks a {@link NormalizedNodeVisitor} through the NormalizedNode
+ *
+ * {@link NormalizedNode } is a tree like structure that provides a generic structure for a yang data model
+ *
+ * For examples of visitors
+ * @see NormalizedNodePrinter
+ *
+ *
+ */
+public class NormalizedNodeNavigator {
+
+ private final org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeVisitor
+ visitor;
+
+ public NormalizedNodeNavigator(
+ org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeVisitor visitor){
+ Preconditions.checkNotNull(visitor, "visitor should not be null");
+ this.visitor = visitor;
+ }
+ public void navigate(String parentPath, NormalizedNode<?,?> normalizedNode){
+ if(parentPath == null){
+ parentPath = "";
+ }
+ navigateNormalizedNode(0, parentPath, normalizedNode);
+ }
+
+ private void navigateDataContainerNode(int level, final String parentPath, final DataContainerNode<?> dataContainerNode){
+ visitor.visitNode(level, parentPath ,dataContainerNode);
+
+ String newParentPath = parentPath + "/" + dataContainerNode.getIdentifier().toString();
+
+ final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument,?>> value = dataContainerNode.getValue();
+ for(NormalizedNode<?,?> node : value){
+ if(node instanceof MixinNode && node instanceof NormalizedNodeContainer){
+ navigateNormalizedNodeContainerMixin(level, newParentPath, (NormalizedNodeContainer<?, ?, ?>) node);
+ } else {
+ navigateNormalizedNode(level, newParentPath, node);
+ }
+ }
+
+ }
+
+ private void navigateNormalizedNodeContainerMixin(int level, final String parentPath, NormalizedNodeContainer<?, ?, ?> node) {
+ visitor.visitNode(level, parentPath, node);
+
+ String newParentPath = parentPath + "/" + node.getIdentifier().toString();
+
+ final Iterable<? extends NormalizedNode<?, ?>> value = node.getValue();
+ for(NormalizedNode normalizedNode : value){
+ if(normalizedNode instanceof MixinNode && normalizedNode instanceof NormalizedNodeContainer){
+ navigateNormalizedNodeContainerMixin(level + 1, newParentPath, (NormalizedNodeContainer) normalizedNode);
+ } else {
+ navigateNormalizedNode(level, newParentPath, normalizedNode);
+ }
+ }
+
+ }
+
+
+ private void navigateNormalizedNode(int level, String parentPath, NormalizedNode<?,?> normalizedNode){
+ if(normalizedNode instanceof DataContainerNode){
+
+ final DataContainerNode<?> dataContainerNode = (DataContainerNode) normalizedNode;
+
+ navigateDataContainerNode(level + 1, parentPath, dataContainerNode);
+ } else {
+ visitor.visitNode(level+1, parentPath, normalizedNode);
+ }
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class NormalizedNodePrinter implements NormalizedNodeVisitor {
+
+ private String spaces(int n){
+ StringBuilder builder = new StringBuilder();
+ for(int i=0;i<n;i++){
+ builder.append(' ');
+ }
+ return builder.toString();
+ }
+
+ @Override
+ public void visitNode(int level, String parentPath, NormalizedNode normalizedNode) {
+ System.out.println(spaces((level) * 4) + normalizedNode.getClass().toString() + ":" + normalizedNode.getIdentifier());
+ if(normalizedNode instanceof LeafNode || normalizedNode instanceof LeafSetEntryNode){
+ System.out.println(spaces((level) * 4) + " parentPath = " + parentPath);
+ System.out.println(spaces((level) * 4) + " key = " + normalizedNode.getClass().toString() + ":" + normalizedNode.getIdentifier());
+ System.out.println(spaces((level) * 4) + " value = " + normalizedNode.getValue());
+ }
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public interface NormalizedNodeVisitor {
+ public void visitNode(int level, String parentPath, NormalizedNode normalizedNode);
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+public class PathUtils {
+ public static String getParentPath(String currentElementPath){
+ String parentPath = "";
+
+ if(currentElementPath != null){
+ String[] parentPaths = currentElementPath.split("/");
+ if(parentPaths.length > 2){
+ for(int i=0;i<parentPaths.length-1;i++){
+ if(parentPaths[i].length() > 0){
+ parentPath += "/" + parentPaths[i];
+ }
+ }
+ }
+ }
+ return parentPath;
+ }
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class QNameFactory {
+ private static final Map<String, QName> cache = new HashMap<>();
+
+ public static QName create(String name){
+ QName value = cache.get(name);
+ if(value == null){
+ synchronized (cache){
+ value = cache.get(name);
+ if(value == null) {
+ value = QName.create(name);
+ cache.put(name, value);
+ }
+ }
+ }
+ return value;
+ }
+}
import com.google.common.collect.Lists;
import org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser.DomToNormalizedNodeParserFactory;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serializer.DomFromNormalizedNodeSerializerFactory;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.w3c.dom.Document;
import javax.xml.transform.stream.StreamResult;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
+import java.util.Collection;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
/*
* @author: syedbahm
*/
public class EncoderDecoderUtil {
- static DocumentBuilderFactory factory;
- static {
- factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- factory.setCoalescing(true);
- factory.setIgnoringElementContentWhitespace(true);
- factory.setIgnoringComments(true);
- }
+ static DocumentBuilderFactory factory;
- private static DataSchemaNode findChildNode(Iterable<DataSchemaNode> children,
- String name) {
- List<DataNodeContainer> containers = Lists.newArrayList();
-
- for (DataSchemaNode dataSchemaNode : children) {
- if (dataSchemaNode.getQName().getLocalName().equals(name))
- return dataSchemaNode;
- if (dataSchemaNode instanceof DataNodeContainer) {
- containers.add((DataNodeContainer) dataSchemaNode);
- } else if (dataSchemaNode instanceof ChoiceNode) {
- containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
- }
+ private static DomFromNormalizedNodeSerializerFactory serializerFactory =
+ DomFromNormalizedNodeSerializerFactory
+ .getInstance(XmlDocumentUtils.getDocument(),
+ DomUtils.defaultValueCodecProvider());
+
+ private static DomToNormalizedNodeParserFactory parserFactory =
+ DomToNormalizedNodeParserFactory
+ .getInstance(DomUtils.defaultValueCodecProvider());
+
+ static {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setCoalescing(true);
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setIgnoringComments(true);
}
- for (DataNodeContainer container : containers) {
- DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
- if (retVal != null) {
- return retVal;
- }
+ private static DataSchemaNode findChildNode(Collection<DataSchemaNode> children,
+ String name) {
+ List<DataNodeContainer> containers = Lists.newArrayList();
+
+ for (DataSchemaNode dataSchemaNode : children) {
+ if (dataSchemaNode.getQName().getLocalName().equals(name))
+ return dataSchemaNode;
+ if (dataSchemaNode instanceof DataNodeContainer) {
+ containers.add((DataNodeContainer) dataSchemaNode);
+ } else if (dataSchemaNode instanceof ChoiceNode) {
+ containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
+ }
+ }
+
+ for (DataNodeContainer container : containers) {
+ DataSchemaNode retVal =
+ findChildNode(container.getChildNodes(), name);
+ if (retVal != null) {
+ return retVal;
+ }
+ }
+
+ return null;
}
- return null;
- }
+ private static DataSchemaNode getSchemaNode(SchemaContext context,
+ QName qname) {
- private static DataSchemaNode getSchemaNode(SchemaContext context, QName qname) {
+ for (Module module : context
+ .findModuleByNamespace(qname.getNamespace())) {
+ // we will take the first child as the start of the
+ if (module.getChildNodes() != null || !module.getChildNodes()
+ .isEmpty()) {
- for (Module module : context.findModuleByNamespace(qname.getNamespace())) {
- // we will take the first child as the start of the
- if (module.getChildNodes() != null || !module.getChildNodes().isEmpty()) {
+ DataSchemaNode found =
+ findChildNode(module.getChildNodes(), qname.getLocalName());
+ return found;
+ }
+ }
+ return null;
+ }
- DataSchemaNode found =
- findChildNode(module.getChildNodes(), qname.getLocalName());
- return found;
- }
+ private static String toString(Element xml) {
+ try {
+ Transformer transformer =
+ TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+ StreamResult result = new StreamResult(new StringWriter());
+ DOMSource source = new DOMSource(xml);
+ transformer.transform(source, result);
+
+ return result.getWriter().toString();
+ } catch (IllegalArgumentException | TransformerFactoryConfigurationError
+ | TransformerException e) {
+ throw new RuntimeException("Unable to serialize xml element " + xml,
+ e);
+ }
}
- return null;
- }
- private static String toString(Element xml) {
+ private static String toString(Iterable<Element> xmlIterable) {
try {
Transformer transformer =
TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
StreamResult result = new StreamResult(new StringWriter());
- DOMSource source = new DOMSource(xml);
- transformer.transform(source, result);
+ Iterator iterator = xmlIterable.iterator();
+ DOMSource source;
+ if(iterator.hasNext()) {
+ source = new DOMSource((org.w3c.dom.Node) iterator.next());
+ transformer.transform(source, result);
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ }
+ while(iterator.hasNext()) {
+ source = new DOMSource((org.w3c.dom.Node) iterator.next());
+ transformer.transform(source, result);
+ }
+ System.out.println(result.getWriter().toString());
return result.getWriter().toString();
} catch (IllegalArgumentException | TransformerFactoryConfigurationError
| TransformerException e) {
- throw new RuntimeException("Unable to serialize xml element " + xml, e);
+ throw new RuntimeException("Unable to serialize xml element(s) " + xmlIterable.toString(),
+ e);
}
}
- /**
- * Helps in generation of NormalizedNodeXml message for the supplied NormalizedNode
- *
- * @param sc --SchemaContext
- * @param normalizedNode -- Normalized Node to be encoded
- * @return SimpleNormalizedNodeMessage.NormalizedNodeXml
- */
- public static SimpleNormalizedNodeMessage.NormalizedNodeXml encode(
- SchemaContext sc, NormalizedNode<?, ?> normalizedNode) {
- Preconditions.checkArgument(sc != null, "Schema context found null");
- Preconditions.checkArgument(normalizedNode != null,
- "normalized node found null");
- ContainerSchemaNode containerNode =
- (ContainerSchemaNode) getSchemaNode(sc, normalizedNode.getIdentifier()
- .getNodeType());
- Preconditions.checkState(containerNode != null,
- "Couldn't find schema node for " + normalizedNode.getIdentifier());
- Iterable<Element> els =
- DomFromNormalizedNodeSerializerFactory
- .getInstance(XmlDocumentUtils.getDocument(),
- DomUtils.defaultValueCodecProvider())
- .getContainerNodeSerializer()
- .serialize(containerNode, (ContainerNode) normalizedNode);
- String xmlString = toString(els.iterator().next());
- SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builder =
- SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder();
- builder.setXmlString(xmlString);
- builder.setNodeIdentifier(((ContainerNode) normalizedNode).getIdentifier()
- .getNodeType().toString());
- return builder.build();
+ private static Iterable<Element> serialize(DataSchemaNode schemaNode, NormalizedNode normalizedNode){
+ if(schemaNode instanceof ContainerSchemaNode){ //1
+ return serializerFactory
+ .getContainerNodeSerializer()
+ .serialize((ContainerSchemaNode) schemaNode,
+ (ContainerNode) normalizedNode);
+ } else if(schemaNode instanceof ChoiceNode){ //2
+ return serializerFactory
+ .getChoiceNodeSerializer()
+ .serialize((ChoiceNode) schemaNode,
+ (org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) normalizedNode);
+ } else if(schemaNode instanceof LeafSchemaNode){ //3
+ return serializerFactory
+ .getLeafNodeSerializer()
+ .serialize((LeafSchemaNode) schemaNode, (LeafNode) normalizedNode);
+ } else if(schemaNode instanceof ListSchemaNode){ //4
+ return serializerFactory
+ .getMapNodeSerializer()
+ .serialize((ListSchemaNode) schemaNode, (MapNode) normalizedNode);
+ } else if(schemaNode instanceof LeafListSchemaNode){ //5
+ return serializerFactory
+ .getLeafSetNodeSerializer()
+ .serialize((LeafListSchemaNode) schemaNode, (LeafSetNode) normalizedNode);
+ } else if(schemaNode instanceof AugmentationSchema){//6
+ return serializerFactory
+ .getAugmentationNodeSerializer()
+ .serialize((AugmentationSchema) schemaNode, (AugmentationNode) normalizedNode);
+ } else if(schemaNode instanceof ListSchemaNode && normalizedNode instanceof LeafSetEntryNode){ //7
+ return serializerFactory
+ .getLeafSetEntryNodeSerializer()
+ .serialize((LeafListSchemaNode) schemaNode, (LeafSetEntryNode) normalizedNode);
+ } else if(schemaNode instanceof ListSchemaNode){ //8
+ return serializerFactory
+ .getMapEntryNodeSerializer()
+ .serialize((ListSchemaNode) schemaNode, (MapEntryNode) normalizedNode);
+ }
- }
- /**
- * Utilizes the SimpleNormalizedNodeMessage.NormalizedNodeXml to convert into NormalizedNode
- *
- * @param sc -- schema context
- * @param normalizedNodeXml -- containing the normalized Node XML
- * @return NormalizedNode return
- * @throws Exception
- */
-
- public static NormalizedNode decode(SchemaContext sc,
- SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNodeXml)
- throws Exception {
- Preconditions.checkArgument(sc != null, "schema context seems to be null");
- Preconditions.checkArgument(normalizedNodeXml != null,
- "SimpleNormalizedNodeMessage.NormalizedNodeXml found to be null");
- QName qname = QName.create(normalizedNodeXml.getNodeIdentifier());
-
- // here we will try to get back the NormalizedNode
- ContainerSchemaNode containerSchemaNode =
- (ContainerSchemaNode) getSchemaNode(sc, qname);
-
- // now we need to read the XML
-
- Document doc =
- factory.newDocumentBuilder().parse(
- new ByteArrayInputStream(normalizedNodeXml.getXmlString().getBytes(
- "utf-8")));
- doc.getDocumentElement().normalize();
-
- ContainerNode result =
- DomToNormalizedNodeParserFactory
- .getInstance(DomUtils.defaultValueCodecProvider())
- .getContainerNodeParser()
- .parse(Collections.singletonList(doc.getDocumentElement()),
- containerSchemaNode);
- return (NormalizedNode) result;
+ throw new UnsupportedOperationException(schemaNode.getClass().toString());
+ }
- }
+ private static NormalizedNode parse(Document doc, DataSchemaNode schemaNode){
+ if(schemaNode instanceof ContainerSchemaNode){
+ return parserFactory
+ .getContainerNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ (ContainerSchemaNode) schemaNode);
+
+ } else if(schemaNode instanceof ChoiceNode){
+ return parserFactory
+ .getChoiceNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ (ChoiceNode) schemaNode);
+ } else if(schemaNode instanceof LeafNode){
+ return parserFactory
+ .getLeafNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ (LeafSchemaNode) schemaNode);
+ } else if(schemaNode instanceof ListSchemaNode){
+ return parserFactory
+ .getMapNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ (ListSchemaNode) schemaNode);
+ } else if(schemaNode instanceof LeafListSchemaNode){
+ return parserFactory
+ .getLeafSetNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ (LeafListSchemaNode) schemaNode);
+ } else if(schemaNode instanceof AugmentationSchema){
+ return parserFactory
+ .getAugmentationNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ (AugmentationSchema) schemaNode);
+ } else if(schemaNode instanceof ListSchemaNode){
+ return parserFactory
+ .getMapEntryNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ (ListSchemaNode) schemaNode);
+
+ }
+
+ throw new UnsupportedOperationException(schemaNode.getClass().toString());
+ }
+
+
+ /**
+ * Helps in generation of NormalizedNodeXml message for the supplied NormalizedNode
+ *
+ * @param sc --SchemaContext
+ * @param normalizedNode -- Normalized Node to be encoded
+ * @return SimpleNormalizedNodeMessage.NormalizedNodeXml
+ */
+ public static SimpleNormalizedNodeMessage.NormalizedNodeXml encode(
+ SchemaContext sc, NormalizedNode<?, ?> normalizedNode) {
+
+ Preconditions.checkArgument(sc != null, "Schema context found null");
+
+ Preconditions.checkArgument(normalizedNode != null,
+ "normalized node found null");
+
+ DataSchemaNode schemaNode = getSchemaNode(sc,
+ normalizedNode.getIdentifier()
+ .getNodeType()
+ );
+
+ Preconditions.checkState(schemaNode != null,
+ "Couldn't find schema node for " + normalizedNode.getIdentifier());
+
+ Iterable<Element> els = serialize(schemaNode, normalizedNode);
+
+ String xmlString = toString(els.iterator().next());
+ SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builder =
+ SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder();
+ builder.setXmlString(xmlString);
+ builder
+ .setNodeIdentifier(normalizedNode.getIdentifier()
+ .getNodeType().toString());
+ return builder.build();
+
+ }
+
+ /**
+ * Utilizes the SimpleNormalizedNodeMessage.NormalizedNodeXml to convert into NormalizedNode
+ *
+ * @param sc -- schema context
+ * @param normalizedNodeXml -- containing the normalized Node XML
+ * @return NormalizedNode return
+ * @throws Exception
+ */
+
+ public static NormalizedNode decode(SchemaContext sc,
+ SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNodeXml)
+ throws Exception {
+
+ Preconditions
+ .checkArgument(sc != null, "schema context seems to be null");
+
+ Preconditions.checkArgument(normalizedNodeXml != null,
+ "SimpleNormalizedNodeMessage.NormalizedNodeXml found to be null");
+ QName qname = QName.create(normalizedNodeXml.getNodeIdentifier());
+
+ // here we will try to get back the NormalizedNode
+ DataSchemaNode schemaNode = getSchemaNode(sc, qname);
+
+ // now we need to read the XML
+ Document doc =
+ factory.newDocumentBuilder().parse(
+ new ByteArrayInputStream(
+ normalizedNodeXml.getXmlString().getBytes(
+ "utf-8"))
+ );
+
+ doc.getDocumentElement().normalize();
+
+
+ return parse(doc, schemaNode);
+ }
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.util;
+
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class contains utility methods for converting an MD-SAL
+ * YangInstanceIdentifier to and from other representations.
+ * <p>
+ * The representations convered for now are,
+ *
+ * <ul>
+ * <li>String</li>
+ * <li>Protocol Buffer</li>
+ * </ul>
+ */
+public class InstanceIdentifierUtils {
+
+ protected static final Logger logger = LoggerFactory
+ .getLogger(InstanceIdentifierUtils.class);
+
+ @Deprecated
+ public static YangInstanceIdentifier from(String path) {
+ String[] ids = path.split("/");
+
+ List<YangInstanceIdentifier.PathArgument> pathArguments =
+ new ArrayList<>();
+ for (String nodeId : ids) {
+ if (!"".equals(nodeId)) {
+ pathArguments
+ .add(NodeIdentifierFactory.getArgument(nodeId));
+ }
+ }
+ final YangInstanceIdentifier instanceIdentifier =
+ YangInstanceIdentifier.create(pathArguments);
+ return instanceIdentifier;
+ }
+
+
+ /**
+ * Convert an MD-SAL YangInstanceIdentifier into a protocol buffer version of it
+ *
+ * @param path an MD-SAL YangInstanceIdentifier
+ * @return a protocol buffer version of the MD-SAL YangInstanceIdentifier
+ */
+ public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path){
+ NormalizedNodeMessages.InstanceIdentifier.Builder builder =
+ NormalizedNodeMessages.InstanceIdentifier.newBuilder();
+
+ try {
+
+ for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument pathArgument : path
+ .getPathArguments()) {
+
+ String nodeType = "";
+ if(!(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier)){
+ nodeType = pathArgument.getNodeType().toString();
+ }
+
+ NormalizedNodeMessages.PathArgument serializablePathArgument =
+ NormalizedNodeMessages.PathArgument.newBuilder()
+ .setValue(pathArgument.toString())
+ .setType(pathArgument.getClass().getSimpleName())
+ .setNodeType(NormalizedNodeMessages.QName.newBuilder()
+ .setValue(nodeType))
+ .addAllAttributes(getPathArgumentAttributes(
+ pathArgument))
+ .build();
+
+ builder.addArguments(serializablePathArgument);
+ }
+
+ } catch(Exception e){
+ logger.error("An exception occurred", e);
+ }
+ return builder.build();
+ }
+
+
+ /**
+ * Convert a protocol buffer version of the MD-SAL YangInstanceIdentifier into
+ * the MD-SAL version of the YangInstanceIdentifier
+ *
+ * @param path a protocol buffer version of the MD-SAL YangInstanceIdentifier
+ * @return an MD-SAL YangInstanceIdentifier
+ */
+ public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path){
+
+ List<YangInstanceIdentifier.PathArgument> pathArguments =
+ new ArrayList<>();
+
+ for(NormalizedNodeMessages.PathArgument pathArgument : path.getArgumentsList()){
+
+ pathArguments
+ .add(parsePathArgument(pathArgument));
+
+ }
+
+ final YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier.create(pathArguments);
+
+ return instanceIdentifier;
+ }
+
+ /**
+ * Take the various attributes of a PathArgument and package them up as
+ * protocol buffer attributes.
+ * <p>
+ *
+ * PathArguments have 4 subtypes and each of the various subtypes have
+ * different attributes
+ * <ul>
+ * <li>
+ * NodeIdentifier is the most basic PathArgument. It is used for
+ * ContainerNode, LeafNode etc and has no attributes
+ * </li>
+ * <li>
+ * NodeWithValue has only a single attribute. It is used for
+ * LeafListEntryNodes and the attribute it contains is the value
+ * of the entry
+ * </li>
+ * <li>
+ * NodeIdentifierWithPredicates has a map of attributes.
+ * It is used to represent a ListItemNode. Each entry
+ * in the map of attributes represents the key and value of the
+ * keys in that entry.
+ * </li>
+ * <li>
+ * AugmentationIdentifier has a list of unnamed attributes. Each
+ * attribute represents the possible children that can go within
+ * an augmentation entry.
+ * </li>
+ * </ul>
+ * @param pathArgument
+ * @return
+ */
+ private static Iterable<? extends NormalizedNodeMessages.Attribute> getPathArgumentAttributes(
+ YangInstanceIdentifier.PathArgument pathArgument) {
+ List<NormalizedNodeMessages.Attribute> attributes = new ArrayList<>();
+
+
+
+ if (pathArgument instanceof YangInstanceIdentifier.NodeWithValue) {
+ YangInstanceIdentifier.NodeWithValue identifier
+ = (YangInstanceIdentifier.NodeWithValue) pathArgument;
+
+ NormalizedNodeMessages.Attribute attribute =
+ NormalizedNodeMessages.Attribute.newBuilder()
+ .setName("name")
+ .setValue(identifier.getValue().toString())
+ .setType(identifier.getValue().getClass().getSimpleName())
+ .build();
+
+ attributes.add(attribute);
+ } else if (pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
+ YangInstanceIdentifier.NodeIdentifierWithPredicates identifier
+ = (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument;
+
+ for (QName key : identifier.getKeyValues().keySet()) {
+ Object value = identifier.getKeyValues().get(key);
+ NormalizedNodeMessages.Attribute attribute =
+ NormalizedNodeMessages.Attribute.newBuilder()
+ .setName(key.toString())
+ .setValue(value.toString())
+ .setType(value.getClass().getSimpleName())
+ .build();
+
+ attributes.add(attribute);
+
+ }
+
+ } else if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier) {
+ YangInstanceIdentifier.AugmentationIdentifier identifier
+ = (YangInstanceIdentifier.AugmentationIdentifier) pathArgument;
+
+ for (QName key : identifier.getPossibleChildNames()) {
+ Object value = key;
+ NormalizedNodeMessages.Attribute attribute =
+ NormalizedNodeMessages.Attribute.newBuilder()
+ .setName(key.toString())
+ .setValue(value.toString())
+ .setType(value.getClass().getSimpleName())
+ .build();
+
+ attributes.add(attribute);
+
+ }
+ }
+
+ return attributes;
+ }
+
+
+ /**
+ * Parse a protocol buffer PathArgument and return an MD-SAL PathArgument
+ *
+ * @param pathArgument protocol buffer PathArgument
+ * @return MD-SAL PathArgument
+ */
+ private static YangInstanceIdentifier.PathArgument parsePathArgument(NormalizedNodeMessages.PathArgument pathArgument) {
+ if (YangInstanceIdentifier.NodeWithValue.class.getSimpleName().equals(pathArgument.getType())) {
+
+ YangInstanceIdentifier.NodeWithValue nodeWithValue =
+ new YangInstanceIdentifier.NodeWithValue(
+ QName.create(pathArgument.getNodeType().getValue()),
+ parseAttribute(pathArgument.getAttributes(0)));
+
+ return nodeWithValue;
+
+ } else if(YangInstanceIdentifier.NodeIdentifierWithPredicates.class.getSimpleName().equals(pathArgument.getType())){
+
+ YangInstanceIdentifier.NodeIdentifierWithPredicates
+ nodeIdentifierWithPredicates =
+ new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+ QName.create(pathArgument.getNodeType().getValue()), toAttributesMap(pathArgument.getAttributesList()));
+
+ return nodeIdentifierWithPredicates;
+
+ } else if(YangInstanceIdentifier.AugmentationIdentifier.class.getSimpleName().equals(pathArgument.getType())){
+
+ Set<QName> qNameSet = new HashSet<>();
+
+ for(NormalizedNodeMessages.Attribute attribute : pathArgument.getAttributesList()){
+ qNameSet.add(QName.create(attribute.getValue()));
+ }
+
+ return new YangInstanceIdentifier.AugmentationIdentifier(qNameSet);
+ }
+
+ return NodeIdentifierFactory.getArgument(pathArgument.getValue());
+ }
+
+ private static Map<QName, Object> toAttributesMap(
+ List<NormalizedNodeMessages.Attribute> attributesList) {
+
+ Map<QName, Object> map = new HashMap<>();
+
+ for(NormalizedNodeMessages.Attribute attribute : attributesList){
+ String name = attribute.getName();
+ Object value = parseAttribute(attribute);
+
+ map.put(QName.create(name), value);
+ }
+
+ return map;
+ }
+
+ /**
+ * FIXME: This method only covers a subset of values that may go in an InstanceIdentifier
+ *
+ * @param attribute
+ * @return
+ */
+ private static Object parseAttribute(NormalizedNodeMessages.Attribute attribute){
+ if(Short.class.getSimpleName().equals(attribute.getType())) {
+ return Short.parseShort(attribute.getValue());
+ } else if(Long.class.getSimpleName().equals(attribute.getType())){
+ return Long.parseLong(attribute.getValue());
+ } else if(Boolean.class.getSimpleName().equals(attribute.getType())){
+ return Boolean.parseBoolean(attribute.getValue());
+ } else if(Integer.class.getSimpleName().equals(attribute.getType())){
+ return Integer.parseInt(attribute.getValue());
+ }
+
+ return attribute.getValue();
+ }
+}
--- /dev/null
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: CompositeModificationPayload.proto
+
+package org.opendaylight.controller.mdsal;
+
+public final class CompositeModificationPayload {
+ private CompositeModificationPayload() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registry.add(org.opendaylight.controller.mdsal.CompositeModificationPayload.modification);
+ }
+ public static final int MODIFICATION_FIELD_NUMBER = 2;
+ /**
+ * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+ */
+ public static final
+ com.google.protobuf.GeneratedMessage.GeneratedExtension<
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification> modification = com.google.protobuf.GeneratedMessage
+ .newFileScopedGeneratedExtension(
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class,
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.getDefaultInstance());
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\"CompositeModificationPayload.proto\022!or" +
+ "g.opendaylight.controller.mdsal\032\033AppendE" +
+ "ntriesMessages.proto\032\014Common.proto\032\020Pers" +
+ "istent.proto:\242\001\n\014modification\022R.org.open" +
+ "daylight.controller.cluster.raft.AppendE" +
+ "ntries.ReplicatedLogEntry.Payload\030\002 \001(\0132" +
+ "8.org.opendaylight.controller.mdsal.Comp" +
+ "ositeModification"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ modification.internalInit(descriptor.getExtensions().get(0));
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.getDescriptor(),
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
--- /dev/null
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: Cohort.proto
+
+package org.opendaylight.controller.protobuff.messages.cohort3pc;
+
+public final class ThreePhaseCommitCohortMessages {
+ private ThreePhaseCommitCohortMessages() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ public interface CanCommitTransactionOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CanCommitTransaction}
+ */
+ public static final class CanCommitTransaction extends
+ com.google.protobuf.GeneratedMessage
+ implements CanCommitTransactionOrBuilder {
+ // Use CanCommitTransaction.newBuilder() to construct.
+ private CanCommitTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private CanCommitTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final CanCommitTransaction defaultInstance;
+ public static CanCommitTransaction getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public CanCommitTransaction getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private CanCommitTransaction(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<CanCommitTransaction> PARSER =
+ new com.google.protobuf.AbstractParser<CanCommitTransaction>() {
+ public CanCommitTransaction parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new CanCommitTransaction(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<CanCommitTransaction> getParserForType() {
+ return PARSER;
+ }
+
+ private void initFields() {
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CanCommitTransaction}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction build() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction buildPartial() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction(this);
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction other) {
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.getDefaultInstance()) return this;
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CanCommitTransaction)
+ }
+
+ static {
+ defaultInstance = new CanCommitTransaction(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CanCommitTransaction)
+ }
+
+ public interface CanCommitTransactionReplyOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required bool canCommit = 1;
+ /**
+ * <code>required bool canCommit = 1;</code>
+ */
+ boolean hasCanCommit();
+ /**
+ * <code>required bool canCommit = 1;</code>
+ */
+ boolean getCanCommit();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CanCommitTransactionReply}
+ */
+ public static final class CanCommitTransactionReply extends
+ com.google.protobuf.GeneratedMessage
+ implements CanCommitTransactionReplyOrBuilder {
+ // Use CanCommitTransactionReply.newBuilder() to construct.
+ private CanCommitTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private CanCommitTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final CanCommitTransactionReply defaultInstance;
+ public static CanCommitTransactionReply getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public CanCommitTransactionReply getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private CanCommitTransactionReply(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 8: {
+ bitField0_ |= 0x00000001;
+ canCommit_ = input.readBool();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<CanCommitTransactionReply> PARSER =
+ new com.google.protobuf.AbstractParser<CanCommitTransactionReply>() {
+ public CanCommitTransactionReply parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new CanCommitTransactionReply(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<CanCommitTransactionReply> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required bool canCommit = 1;
+ public static final int CANCOMMIT_FIELD_NUMBER = 1;
+ private boolean canCommit_;
+ /**
+ * <code>required bool canCommit = 1;</code>
+ */
+ public boolean hasCanCommit() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bool canCommit = 1;</code>
+ */
+ public boolean getCanCommit() {
+ return canCommit_;
+ }
+
+ private void initFields() {
+ canCommit_ = false;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasCanCommit()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBool(1, canCommit_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBoolSize(1, canCommit_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CanCommitTransactionReply}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReplyOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ canCommit_ = false;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply build() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply buildPartial() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.canCommit_ = canCommit_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply other) {
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.getDefaultInstance()) return this;
+ if (other.hasCanCommit()) {
+ setCanCommit(other.getCanCommit());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasCanCommit()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required bool canCommit = 1;
+ private boolean canCommit_ ;
+ /**
+ * <code>required bool canCommit = 1;</code>
+ */
+ public boolean hasCanCommit() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required bool canCommit = 1;</code>
+ */
+ public boolean getCanCommit() {
+ return canCommit_;
+ }
+ /**
+ * <code>required bool canCommit = 1;</code>
+ */
+ public Builder setCanCommit(boolean value) {
+ bitField0_ |= 0x00000001;
+ canCommit_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required bool canCommit = 1;</code>
+ */
+ public Builder clearCanCommit() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ canCommit_ = false;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CanCommitTransactionReply)
+ }
+
+ static {
+ defaultInstance = new CanCommitTransactionReply(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CanCommitTransactionReply)
+ }
+
+ public interface AbortTransactionOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.AbortTransaction}
+ */
+ public static final class AbortTransaction extends
+ com.google.protobuf.GeneratedMessage
+ implements AbortTransactionOrBuilder {
+ // Use AbortTransaction.newBuilder() to construct.
+ private AbortTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private AbortTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final AbortTransaction defaultInstance;
+ public static AbortTransaction getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public AbortTransaction getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private AbortTransaction(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<AbortTransaction> PARSER =
+ new com.google.protobuf.AbstractParser<AbortTransaction>() {
+ public AbortTransaction parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new AbortTransaction(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<AbortTransaction> getParserForType() {
+ return PARSER;
+ }
+
+ private void initFields() {
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.AbortTransaction}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction build() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction buildPartial() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction(this);
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction other) {
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.getDefaultInstance()) return this;
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.AbortTransaction)
+ }
+
+ static {
+ defaultInstance = new AbortTransaction(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.AbortTransaction)
+ }
+
+ public interface AbortTransactionReplyOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.AbortTransactionReply}
+ */
+ public static final class AbortTransactionReply extends
+ com.google.protobuf.GeneratedMessage
+ implements AbortTransactionReplyOrBuilder {
+ // Use AbortTransactionReply.newBuilder() to construct.
+ private AbortTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private AbortTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final AbortTransactionReply defaultInstance;
+ public static AbortTransactionReply getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public AbortTransactionReply getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private AbortTransactionReply(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<AbortTransactionReply> PARSER =
+ new com.google.protobuf.AbstractParser<AbortTransactionReply>() {
+ public AbortTransactionReply parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new AbortTransactionReply(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<AbortTransactionReply> getParserForType() {
+ return PARSER;
+ }
+
+ private void initFields() {
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.AbortTransactionReply}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReplyOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply build() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply buildPartial() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply(this);
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply other) {
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.getDefaultInstance()) return this;
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.AbortTransactionReply)
+ }
+
+ static {
+ defaultInstance = new AbortTransactionReply(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.AbortTransactionReply)
+ }
+
+ public interface CommitTransactionOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CommitTransaction}
+ */
+ public static final class CommitTransaction extends
+ com.google.protobuf.GeneratedMessage
+ implements CommitTransactionOrBuilder {
+ // Use CommitTransaction.newBuilder() to construct.
+ private CommitTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private CommitTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final CommitTransaction defaultInstance;
+ public static CommitTransaction getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public CommitTransaction getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private CommitTransaction(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<CommitTransaction> PARSER =
+ new com.google.protobuf.AbstractParser<CommitTransaction>() {
+ public CommitTransaction parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new CommitTransaction(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<CommitTransaction> getParserForType() {
+ return PARSER;
+ }
+
+ private void initFields() {
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CommitTransaction}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction build() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction buildPartial() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction(this);
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction other) {
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.getDefaultInstance()) return this;
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CommitTransaction)
+ }
+
+ static {
+ defaultInstance = new CommitTransaction(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CommitTransaction)
+ }
+
+ public interface CommitTransactionReplyOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CommitTransactionReply}
+ */
+ public static final class CommitTransactionReply extends
+ com.google.protobuf.GeneratedMessage
+ implements CommitTransactionReplyOrBuilder {
+ // Use CommitTransactionReply.newBuilder() to construct.
+ private CommitTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private CommitTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final CommitTransactionReply defaultInstance;
+ public static CommitTransactionReply getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public CommitTransactionReply getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private CommitTransactionReply(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<CommitTransactionReply> PARSER =
+ new com.google.protobuf.AbstractParser<CommitTransactionReply>() {
+ public CommitTransactionReply parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new CommitTransactionReply(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<CommitTransactionReply> getParserForType() {
+ return PARSER;
+ }
+
+ private void initFields() {
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CommitTransactionReply}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReplyOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply build() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply buildPartial() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply(this);
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply other) {
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.getDefaultInstance()) return this;
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CommitTransactionReply)
+ }
+
+ static {
+ defaultInstance = new CommitTransactionReply(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CommitTransactionReply)
+ }
+
+ public interface PreCommitTransactionOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.PreCommitTransaction}
+ */
+ public static final class PreCommitTransaction extends
+ com.google.protobuf.GeneratedMessage
+ implements PreCommitTransactionOrBuilder {
+ // Use PreCommitTransaction.newBuilder() to construct.
+ private PreCommitTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private PreCommitTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final PreCommitTransaction defaultInstance;
+ public static PreCommitTransaction getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public PreCommitTransaction getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private PreCommitTransaction(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<PreCommitTransaction> PARSER =
+ new com.google.protobuf.AbstractParser<PreCommitTransaction>() {
+ public PreCommitTransaction parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new PreCommitTransaction(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<PreCommitTransaction> getParserForType() {
+ return PARSER;
+ }
+
+ private void initFields() {
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.PreCommitTransaction}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction build() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction buildPartial() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction(this);
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction other) {
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.getDefaultInstance()) return this;
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PreCommitTransaction)
+ }
+
+ static {
+ defaultInstance = new PreCommitTransaction(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PreCommitTransaction)
+ }
+
+ public interface PreCommitTransactionReplyOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.PreCommitTransactionReply}
+ */
+ public static final class PreCommitTransactionReply extends
+ com.google.protobuf.GeneratedMessage
+ implements PreCommitTransactionReplyOrBuilder {
+ // Use PreCommitTransactionReply.newBuilder() to construct.
+ private PreCommitTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private PreCommitTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final PreCommitTransactionReply defaultInstance;
+ public static PreCommitTransactionReply getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public PreCommitTransactionReply getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private PreCommitTransactionReply(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<PreCommitTransactionReply> PARSER =
+ new com.google.protobuf.AbstractParser<PreCommitTransactionReply>() {
+ public PreCommitTransactionReply parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new PreCommitTransactionReply(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<PreCommitTransactionReply> getParserForType() {
+ return PARSER;
+ }
+
+ private void initFields() {
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.PreCommitTransactionReply}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReplyOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply build() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply buildPartial() {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply(this);
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply other) {
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.getDefaultInstance()) return this;
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PreCommitTransactionReply)
+ }
+
+ static {
+ defaultInstance = new PreCommitTransactionReply(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PreCommitTransactionReply)
+ }
+
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\014Cohort.proto\022!org.opendaylight.control" +
+ "ler.mdsal\"\026\n\024CanCommitTransaction\".\n\031Can" +
+ "CommitTransactionReply\022\021\n\tcanCommit\030\001 \002(" +
+ "\010\"\022\n\020AbortTransaction\"\027\n\025AbortTransactio" +
+ "nReply\"\023\n\021CommitTransaction\"\030\n\026CommitTra" +
+ "nsactionReply\"\026\n\024PreCommitTransaction\"\033\n" +
+ "\031PreCommitTransactionReplyBZ\n8org.openda" +
+ "ylight.controller.protobuff.messages.coh" +
+ "ort3pcB\036ThreePhaseCommitCohortMessages"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor,
+ new java.lang.String[] { });
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor,
+ new java.lang.String[] { "CanCommit", });
+ internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor =
+ getDescriptor().getMessageTypes().get(2);
+ internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor,
+ new java.lang.String[] { });
+ internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor =
+ getDescriptor().getMessageTypes().get(3);
+ internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor,
+ new java.lang.String[] { });
+ internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor =
+ getDescriptor().getMessageTypes().get(4);
+ internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor,
+ new java.lang.String[] { });
+ internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor =
+ getDescriptor().getMessageTypes().get(5);
+ internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor,
+ new java.lang.String[] { });
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor =
+ getDescriptor().getMessageTypes().get(6);
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor,
+ new java.lang.String[] { });
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor =
+ getDescriptor().getMessageTypes().get(7);
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor,
+ new java.lang.String[] { });
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
--- /dev/null
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: Common.proto
+
+package org.opendaylight.controller.protobuff.messages.common;
+
+public final class NormalizedNodeMessages {
+ private NormalizedNodeMessages() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ public interface AttributeOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string name = 1;
+ /**
+ * <code>required string name = 1;</code>
+ */
+ boolean hasName();
+ /**
+ * <code>required string name = 1;</code>
+ */
+ java.lang.String getName();
+ /**
+ * <code>required string name = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getNameBytes();
+
+ // optional string value = 2;
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ boolean hasValue();
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ java.lang.String getValue();
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ com.google.protobuf.ByteString
+ getValueBytes();
+
+ // optional string type = 3;
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ boolean hasType();
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ java.lang.String getType();
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ com.google.protobuf.ByteString
+ getTypeBytes();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.Attribute}
+ */
+ public static final class Attribute extends
+ com.google.protobuf.GeneratedMessage
+ implements AttributeOrBuilder {
+ // Use Attribute.newBuilder() to construct.
+ private Attribute(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private Attribute(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final Attribute defaultInstance;
+ public static Attribute getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Attribute getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private Attribute(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ name_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ value_ = input.readBytes();
+ break;
+ }
+ case 26: {
+ bitField0_ |= 0x00000004;
+ type_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<Attribute> PARSER =
+ new com.google.protobuf.AbstractParser<Attribute>() {
+ public Attribute parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new Attribute(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<Attribute> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string name = 1;
+ public static final int NAME_FIELD_NUMBER = 1;
+ private java.lang.Object name_;
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public boolean hasName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ name_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional string value = 2;
+ public static final int VALUE_FIELD_NUMBER = 2;
+ private java.lang.Object value_;
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ value_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional string type = 3;
+ public static final int TYPE_FIELD_NUMBER = 3;
+ private java.lang.Object type_;
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ type_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private void initFields() {
+ name_ = "";
+ value_ = "";
+ type_ = "";
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasName()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getNameBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getValueBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeBytes(3, getTypeBytes());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getNameBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getValueBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(3, getTypeBytes());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.Attribute}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ value_ = "";
+ bitField0_ = (bitField0_ & ~0x00000002);
+ type_ = "";
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute build() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute buildPartial() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.name_ = name_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.value_ = value_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.type_ = type_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute other) {
+ if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance()) return this;
+ if (other.hasName()) {
+ bitField0_ |= 0x00000001;
+ name_ = other.name_;
+ onChanged();
+ }
+ if (other.hasValue()) {
+ bitField0_ |= 0x00000002;
+ value_ = other.value_;
+ onChanged();
+ }
+ if (other.hasType()) {
+ bitField0_ |= 0x00000004;
+ type_ = other.type_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasName()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string name = 1;
+ private java.lang.Object name_ = "";
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public boolean hasName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public java.lang.String getName() {
+ java.lang.Object ref = name_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public Builder setName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public Builder clearName() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string name = 1;</code>
+ */
+ public Builder setNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ name_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional string value = 2;
+ private java.lang.Object value_ = "";
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ value_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder setValue(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder setValueBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional string type = 3;
+ private java.lang.Object type_ = "";
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ type_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public Builder setType(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000004;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public Builder clearType() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ type_ = getDefaultInstance().getType();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string type = 3;</code>
+ */
+ public Builder setTypeBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000004;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Attribute)
+ }
+
+ static {
+ defaultInstance = new Attribute(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Attribute)
+ }
+
+ public interface QNameOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string value = 1;
+ /**
+ * <code>required string value = 1;</code>
+ */
+ boolean hasValue();
+ /**
+ * <code>required string value = 1;</code>
+ */
+ java.lang.String getValue();
+ /**
+ * <code>required string value = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getValueBytes();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.QName}
+ */
+ public static final class QName extends
+ com.google.protobuf.GeneratedMessage
+ implements QNameOrBuilder {
+ // Use QName.newBuilder() to construct.
+ private QName(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private QName(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final QName defaultInstance;
+ public static QName getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public QName getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private QName(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ value_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<QName> PARSER =
+ new com.google.protobuf.AbstractParser<QName>() {
+ public QName parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new QName(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<QName> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string value = 1;
+ public static final int VALUE_FIELD_NUMBER = 1;
+ private java.lang.Object value_;
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ value_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private void initFields() {
+ value_ = "";
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasValue()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getValueBytes());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getValueBytes());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.QName}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ value_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName build() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName buildPartial() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.value_ = value_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName other) {
+ if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) return this;
+ if (other.hasValue()) {
+ bitField0_ |= 0x00000001;
+ value_ = other.value_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasValue()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string value = 1;
+ private java.lang.Object value_ = "";
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ value_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public Builder setValue(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public Builder setValueBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.QName)
+ }
+
+ static {
+ defaultInstance = new QName(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.QName)
+ }
+
+ public interface PathArgumentOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string value = 1;
+ /**
+ * <code>required string value = 1;</code>
+ */
+ boolean hasValue();
+ /**
+ * <code>required string value = 1;</code>
+ */
+ java.lang.String getValue();
+ /**
+ * <code>required string value = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getValueBytes();
+
+ // optional string type = 2;
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ boolean hasType();
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ java.lang.String getType();
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ com.google.protobuf.ByteString
+ getTypeBytes();
+
+ // optional .org.opendaylight.controller.mdsal.QName nodeType = 3;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ boolean hasNodeType();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder();
+
+ // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>
+ getAttributesList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index);
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ int getAttributesCount();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ getAttributesOrBuilderList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+ int index);
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.PathArgument}
+ */
+ public static final class PathArgument extends
+ com.google.protobuf.GeneratedMessage
+ implements PathArgumentOrBuilder {
+ // Use PathArgument.newBuilder() to construct.
+ private PathArgument(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private PathArgument(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final PathArgument defaultInstance;
+ public static PathArgument getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public PathArgument getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private PathArgument(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ value_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ type_ = input.readBytes();
+ break;
+ }
+ case 26: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ subBuilder = nodeType_.toBuilder();
+ }
+ nodeType_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(nodeType_);
+ nodeType_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000004;
+ break;
+ }
+ case 34: {
+ if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+ attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>();
+ mutable_bitField0_ |= 0x00000008;
+ }
+ attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry));
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+ attributes_ = java.util.Collections.unmodifiableList(attributes_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<PathArgument> PARSER =
+ new com.google.protobuf.AbstractParser<PathArgument>() {
+ public PathArgument parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new PathArgument(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<PathArgument> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string value = 1;
+ public static final int VALUE_FIELD_NUMBER = 1;
+ private java.lang.Object value_;
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ value_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional string type = 2;
+ public static final int TYPE_FIELD_NUMBER = 2;
+ private java.lang.Object type_;
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ type_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional .org.opendaylight.controller.mdsal.QName nodeType = 3;
+ public static final int NODETYPE_FIELD_NUMBER = 3;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName nodeType_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public boolean hasNodeType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType() {
+ return nodeType_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() {
+ return nodeType_;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
+ public static final int ATTRIBUTES_FIELD_NUMBER = 4;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
+ return attributes_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ getAttributesOrBuilderList() {
+ return attributes_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public int getAttributesCount() {
+ return attributes_.size();
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
+ return attributes_.get(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+ int index) {
+ return attributes_.get(index);
+ }
+
+ private void initFields() {
+ value_ = "";
+ type_ = "";
+ nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ attributes_ = java.util.Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasValue()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (hasNodeType()) {
+ if (!getNodeType().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ for (int i = 0; i < getAttributesCount(); i++) {
+ if (!getAttributes(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getValueBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getTypeBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeMessage(3, nodeType_);
+ }
+ for (int i = 0; i < attributes_.size(); i++) {
+ output.writeMessage(4, attributes_.get(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getValueBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getTypeBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(3, nodeType_);
+ }
+ for (int i = 0; i < attributes_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(4, attributes_.get(i));
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.PathArgument}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getNodeTypeFieldBuilder();
+ getAttributesFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ value_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ type_ = "";
+ bitField0_ = (bitField0_ & ~0x00000002);
+ if (nodeTypeBuilder_ == null) {
+ nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ } else {
+ nodeTypeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ if (attributesBuilder_ == null) {
+ attributes_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000008);
+ } else {
+ attributesBuilder_.clear();
+ }
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument build() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument buildPartial() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.value_ = value_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.type_ = type_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ if (nodeTypeBuilder_ == null) {
+ result.nodeType_ = nodeType_;
+ } else {
+ result.nodeType_ = nodeTypeBuilder_.build();
+ }
+ if (attributesBuilder_ == null) {
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ attributes_ = java.util.Collections.unmodifiableList(attributes_);
+ bitField0_ = (bitField0_ & ~0x00000008);
+ }
+ result.attributes_ = attributes_;
+ } else {
+ result.attributes_ = attributesBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument other) {
+ if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance()) return this;
+ if (other.hasValue()) {
+ bitField0_ |= 0x00000001;
+ value_ = other.value_;
+ onChanged();
+ }
+ if (other.hasType()) {
+ bitField0_ |= 0x00000002;
+ type_ = other.type_;
+ onChanged();
+ }
+ if (other.hasNodeType()) {
+ mergeNodeType(other.getNodeType());
+ }
+ if (attributesBuilder_ == null) {
+ if (!other.attributes_.isEmpty()) {
+ if (attributes_.isEmpty()) {
+ attributes_ = other.attributes_;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ } else {
+ ensureAttributesIsMutable();
+ attributes_.addAll(other.attributes_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.attributes_.isEmpty()) {
+ if (attributesBuilder_.isEmpty()) {
+ attributesBuilder_.dispose();
+ attributesBuilder_ = null;
+ attributes_ = other.attributes_;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ attributesBuilder_ =
+ com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getAttributesFieldBuilder() : null;
+ } else {
+ attributesBuilder_.addAllMessages(other.attributes_);
+ }
+ }
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasValue()) {
+
+ return false;
+ }
+ if (hasNodeType()) {
+ if (!getNodeType().isInitialized()) {
+
+ return false;
+ }
+ }
+ for (int i = 0; i < getAttributesCount(); i++) {
+ if (!getAttributes(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string value = 1;
+ private java.lang.Object value_ = "";
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ value_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public Builder setValue(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string value = 1;</code>
+ */
+ public Builder setValueBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional string type = 2;
+ private java.lang.Object type_ = "";
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ type_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public Builder setType(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public Builder clearType() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ type_ = getDefaultInstance().getType();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ *
+ * <pre>
+ *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ * </pre>
+ */
+ public Builder setTypeBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.QName nodeType = 3;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder> nodeTypeBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public boolean hasNodeType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType() {
+ if (nodeTypeBuilder_ == null) {
+ return nodeType_;
+ } else {
+ return nodeTypeBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public Builder setNodeType(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+ if (nodeTypeBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ nodeType_ = value;
+ onChanged();
+ } else {
+ nodeTypeBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public Builder setNodeType(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder builderForValue) {
+ if (nodeTypeBuilder_ == null) {
+ nodeType_ = builderForValue.build();
+ onChanged();
+ } else {
+ nodeTypeBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public Builder mergeNodeType(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+ if (nodeTypeBuilder_ == null) {
+ if (((bitField0_ & 0x00000004) == 0x00000004) &&
+ nodeType_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
+ nodeType_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(nodeType_).mergeFrom(value).buildPartial();
+ } else {
+ nodeType_ = value;
+ }
+ onChanged();
+ } else {
+ nodeTypeBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public Builder clearNodeType() {
+ if (nodeTypeBuilder_ == null) {
+ nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ onChanged();
+ } else {
+ nodeTypeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNodeTypeBuilder() {
+ bitField0_ |= 0x00000004;
+ onChanged();
+ return getNodeTypeFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() {
+ if (nodeTypeBuilder_ != null) {
+ return nodeTypeBuilder_.getMessageOrBuilder();
+ } else {
+ return nodeType_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
+ getNodeTypeFieldBuilder() {
+ if (nodeTypeBuilder_ == null) {
+ nodeTypeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
+ nodeType_,
+ getParentForChildren(),
+ isClean());
+ nodeType_ = null;
+ }
+ return nodeTypeBuilder_;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_ =
+ java.util.Collections.emptyList();
+ private void ensureAttributesIsMutable() {
+ if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+ attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>(attributes_);
+ bitField0_ |= 0x00000008;
+ }
+ }
+
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_;
+
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
+ if (attributesBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(attributes_);
+ } else {
+ return attributesBuilder_.getMessageList();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public int getAttributesCount() {
+ if (attributesBuilder_ == null) {
+ return attributes_.size();
+ } else {
+ return attributesBuilder_.getCount();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
+ if (attributesBuilder_ == null) {
+ return attributes_.get(index);
+ } else {
+ return attributesBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder setAttributes(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+ if (attributesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAttributesIsMutable();
+ attributes_.set(index, value);
+ onChanged();
+ } else {
+ attributesBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder setAttributes(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ attributes_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ attributesBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+ if (attributesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAttributesIsMutable();
+ attributes_.add(value);
+ onChanged();
+ } else {
+ attributesBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder addAttributes(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+ if (attributesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAttributesIsMutable();
+ attributes_.add(index, value);
+ onChanged();
+ } else {
+ attributesBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder addAttributes(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ attributes_.add(builderForValue.build());
+ onChanged();
+ } else {
+ attributesBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder addAttributes(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ attributes_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ attributesBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder addAllAttributes(
+ java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> values) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ super.addAll(values, attributes_);
+ onChanged();
+ } else {
+ attributesBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder clearAttributes() {
+ if (attributesBuilder_ == null) {
+ attributes_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000008);
+ onChanged();
+ } else {
+ attributesBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public Builder removeAttributes(int index) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ attributes_.remove(index);
+ onChanged();
+ } else {
+ attributesBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder(
+ int index) {
+ return getAttributesFieldBuilder().getBuilder(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+ int index) {
+ if (attributesBuilder_ == null) {
+ return attributes_.get(index); } else {
+ return attributesBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ getAttributesOrBuilderList() {
+ if (attributesBuilder_ != null) {
+ return attributesBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(attributes_);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() {
+ return getAttributesFieldBuilder().addBuilder(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder(
+ int index) {
+ return getAttributesFieldBuilder().addBuilder(
+ index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder>
+ getAttributesBuilderList() {
+ return getAttributesFieldBuilder().getBuilderList();
+ }
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ getAttributesFieldBuilder() {
+ if (attributesBuilder_ == null) {
+ attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>(
+ attributes_,
+ ((bitField0_ & 0x00000008) == 0x00000008),
+ getParentForChildren(),
+ isClean());
+ attributes_ = null;
+ }
+ return attributesBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PathArgument)
+ }
+
+ static {
+ defaultInstance = new PathArgument(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PathArgument)
+ }
+
+ public interface InstanceIdentifierOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument>
+ getArgumentsList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index);
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ int getArgumentsCount();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+ getArgumentsOrBuilderList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder(
+ int index);
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.InstanceIdentifier}
+ */
+ public static final class InstanceIdentifier extends
+ com.google.protobuf.GeneratedMessage
+ implements InstanceIdentifierOrBuilder {
+ // Use InstanceIdentifier.newBuilder() to construct.
+ private InstanceIdentifier(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private InstanceIdentifier(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final InstanceIdentifier defaultInstance;
+ public static InstanceIdentifier getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public InstanceIdentifier getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private InstanceIdentifier(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ arguments_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument>();
+ mutable_bitField0_ |= 0x00000001;
+ }
+ arguments_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.PARSER, extensionRegistry));
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ arguments_ = java.util.Collections.unmodifiableList(arguments_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<InstanceIdentifier> PARSER =
+ new com.google.protobuf.AbstractParser<InstanceIdentifier>() {
+ public InstanceIdentifier parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new InstanceIdentifier(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<InstanceIdentifier> getParserForType() {
+ return PARSER;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;
+ public static final int ARGUMENTS_FIELD_NUMBER = 1;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> arguments_;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> getArgumentsList() {
+ return arguments_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+ getArgumentsOrBuilderList() {
+ return arguments_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public int getArgumentsCount() {
+ return arguments_.size();
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index) {
+ return arguments_.get(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder(
+ int index) {
+ return arguments_.get(index);
+ }
+
+ private void initFields() {
+ arguments_ = java.util.Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ for (int i = 0; i < getArgumentsCount(); i++) {
+ if (!getArguments(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ for (int i = 0; i < arguments_.size(); i++) {
+ output.writeMessage(1, arguments_.get(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ for (int i = 0; i < arguments_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, arguments_.get(i));
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.InstanceIdentifier}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getArgumentsFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ if (argumentsBuilder_ == null) {
+ arguments_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ argumentsBuilder_.clear();
+ }
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier build() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier buildPartial() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier(this);
+ int from_bitField0_ = bitField0_;
+ if (argumentsBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ arguments_ = java.util.Collections.unmodifiableList(arguments_);
+ bitField0_ = (bitField0_ & ~0x00000001);
+ }
+ result.arguments_ = arguments_;
+ } else {
+ result.arguments_ = argumentsBuilder_.build();
+ }
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier other) {
+ if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) return this;
+ if (argumentsBuilder_ == null) {
+ if (!other.arguments_.isEmpty()) {
+ if (arguments_.isEmpty()) {
+ arguments_ = other.arguments_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ ensureArgumentsIsMutable();
+ arguments_.addAll(other.arguments_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.arguments_.isEmpty()) {
+ if (argumentsBuilder_.isEmpty()) {
+ argumentsBuilder_.dispose();
+ argumentsBuilder_ = null;
+ arguments_ = other.arguments_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ argumentsBuilder_ =
+ com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getArgumentsFieldBuilder() : null;
+ } else {
+ argumentsBuilder_.addAllMessages(other.arguments_);
+ }
+ }
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ for (int i = 0; i < getArgumentsCount(); i++) {
+ if (!getArguments(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> arguments_ =
+ java.util.Collections.emptyList();
+ private void ensureArgumentsIsMutable() {
+ if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+ arguments_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument>(arguments_);
+ bitField0_ |= 0x00000001;
+ }
+ }
+
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> argumentsBuilder_;
+
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> getArgumentsList() {
+ if (argumentsBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(arguments_);
+ } else {
+ return argumentsBuilder_.getMessageList();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public int getArgumentsCount() {
+ if (argumentsBuilder_ == null) {
+ return arguments_.size();
+ } else {
+ return argumentsBuilder_.getCount();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index) {
+ if (argumentsBuilder_ == null) {
+ return arguments_.get(index);
+ } else {
+ return argumentsBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder setArguments(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) {
+ if (argumentsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureArgumentsIsMutable();
+ arguments_.set(index, value);
+ onChanged();
+ } else {
+ argumentsBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder setArguments(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) {
+ if (argumentsBuilder_ == null) {
+ ensureArgumentsIsMutable();
+ arguments_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ argumentsBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder addArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) {
+ if (argumentsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureArgumentsIsMutable();
+ arguments_.add(value);
+ onChanged();
+ } else {
+ argumentsBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder addArguments(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) {
+ if (argumentsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureArgumentsIsMutable();
+ arguments_.add(index, value);
+ onChanged();
+ } else {
+ argumentsBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder addArguments(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) {
+ if (argumentsBuilder_ == null) {
+ ensureArgumentsIsMutable();
+ arguments_.add(builderForValue.build());
+ onChanged();
+ } else {
+ argumentsBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder addArguments(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) {
+ if (argumentsBuilder_ == null) {
+ ensureArgumentsIsMutable();
+ arguments_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ argumentsBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder addAllArguments(
+ java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> values) {
+ if (argumentsBuilder_ == null) {
+ ensureArgumentsIsMutable();
+ super.addAll(values, arguments_);
+ onChanged();
+ } else {
+ argumentsBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder clearArguments() {
+ if (argumentsBuilder_ == null) {
+ arguments_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ onChanged();
+ } else {
+ argumentsBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public Builder removeArguments(int index) {
+ if (argumentsBuilder_ == null) {
+ ensureArgumentsIsMutable();
+ arguments_.remove(index);
+ onChanged();
+ } else {
+ argumentsBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder getArgumentsBuilder(
+ int index) {
+ return getArgumentsFieldBuilder().getBuilder(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder(
+ int index) {
+ if (argumentsBuilder_ == null) {
+ return arguments_.get(index); } else {
+ return argumentsBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+ getArgumentsOrBuilderList() {
+ if (argumentsBuilder_ != null) {
+ return argumentsBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(arguments_);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder addArgumentsBuilder() {
+ return getArgumentsFieldBuilder().addBuilder(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder addArgumentsBuilder(
+ int index) {
+ return getArgumentsFieldBuilder().addBuilder(
+ index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder>
+ getArgumentsBuilderList() {
+ return getArgumentsFieldBuilder().getBuilderList();
+ }
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+ getArgumentsFieldBuilder() {
+ if (argumentsBuilder_ == null) {
+ argumentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>(
+ arguments_,
+ ((bitField0_ & 0x00000001) == 0x00000001),
+ getParentForChildren(),
+ isClean());
+ arguments_ = null;
+ }
+ return argumentsBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.InstanceIdentifier)
+ }
+
+ static {
+ defaultInstance = new InstanceIdentifier(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.InstanceIdentifier)
+ }
+
+ public interface NodeOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // optional string path = 1;
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ boolean hasPath();
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ java.lang.String getPath();
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getPathBytes();
+
+ // optional string type = 2;
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ boolean hasType();
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ java.lang.String getType();
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ com.google.protobuf.ByteString
+ getTypeBytes();
+
+ // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>
+ getAttributesList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index);
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ int getAttributesCount();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ getAttributesOrBuilderList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+ int index);
+
+ // repeated .org.opendaylight.controller.mdsal.Node child = 4;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>
+ getChildList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index);
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ int getChildCount();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getChildOrBuilderList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
+ int index);
+
+ // optional string value = 5;
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ boolean hasValue();
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ java.lang.String getValue();
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ com.google.protobuf.ByteString
+ getValueBytes();
+
+ // optional string valueType = 6;
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ boolean hasValueType();
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ java.lang.String getValueType();
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ com.google.protobuf.ByteString
+ getValueTypeBytes();
+
+ // repeated string bitsValue = 7;
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ java.util.List<java.lang.String>
+ getBitsValueList();
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ int getBitsValueCount();
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ java.lang.String getBitsValue(int index);
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ com.google.protobuf.ByteString
+ getBitsValueBytes(int index);
+
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ boolean hasInstanceIdentifierValue();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.Node}
+ */
+ public static final class Node extends
+ com.google.protobuf.GeneratedMessage
+ implements NodeOrBuilder {
+ // Use Node.newBuilder() to construct.
+ private Node(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private Node(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final Node defaultInstance;
+ public static Node getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Node getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private Node(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ path_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ type_ = input.readBytes();
+ break;
+ }
+ case 26: {
+ if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
+ attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>();
+ mutable_bitField0_ |= 0x00000004;
+ }
+ attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry));
+ break;
+ }
+ case 34: {
+ if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+ child_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>();
+ mutable_bitField0_ |= 0x00000008;
+ }
+ child_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry));
+ break;
+ }
+ case 42: {
+ bitField0_ |= 0x00000004;
+ value_ = input.readBytes();
+ break;
+ }
+ case 50: {
+ bitField0_ |= 0x00000008;
+ valueType_ = input.readBytes();
+ break;
+ }
+ case 58: {
+ if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
+ bitsValue_ = new com.google.protobuf.LazyStringArrayList();
+ mutable_bitField0_ |= 0x00000040;
+ }
+ bitsValue_.add(input.readBytes());
+ break;
+ }
+ case 66: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ subBuilder = instanceIdentifierValue_.toBuilder();
+ }
+ instanceIdentifierValue_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierValue_);
+ instanceIdentifierValue_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000010;
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
+ attributes_ = java.util.Collections.unmodifiableList(attributes_);
+ }
+ if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+ child_ = java.util.Collections.unmodifiableList(child_);
+ }
+ if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
+ bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(bitsValue_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<Node> PARSER =
+ new com.google.protobuf.AbstractParser<Node>() {
+ public Node parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new Node(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<Node> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // optional string path = 1;
+ public static final int PATH_FIELD_NUMBER = 1;
+ private java.lang.Object path_;
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public boolean hasPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public java.lang.String getPath() {
+ java.lang.Object ref = path_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ path_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getPathBytes() {
+ java.lang.Object ref = path_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ path_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional string type = 2;
+ public static final int TYPE_FIELD_NUMBER = 2;
+ private java.lang.Object type_;
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ type_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
+ public static final int ATTRIBUTES_FIELD_NUMBER = 3;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
+ return attributes_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ getAttributesOrBuilderList() {
+ return attributes_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public int getAttributesCount() {
+ return attributes_.size();
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
+ return attributes_.get(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+ int index) {
+ return attributes_.get(index);
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.Node child = 4;
+ public static final int CHILD_FIELD_NUMBER = 4;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> child_;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> getChildList() {
+ return child_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getChildOrBuilderList() {
+ return child_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public int getChildCount() {
+ return child_.size();
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) {
+ return child_.get(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
+ int index) {
+ return child_.get(index);
+ }
+
+ // optional string value = 5;
+ public static final int VALUE_FIELD_NUMBER = 5;
+ private java.lang.Object value_;
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ value_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional string valueType = 6;
+ public static final int VALUETYPE_FIELD_NUMBER = 6;
+ private java.lang.Object valueType_;
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public boolean hasValueType() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public java.lang.String getValueType() {
+ java.lang.Object ref = valueType_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ valueType_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueTypeBytes() {
+ java.lang.Object ref = valueType_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ valueType_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // repeated string bitsValue = 7;
+ public static final int BITSVALUE_FIELD_NUMBER = 7;
+ private com.google.protobuf.LazyStringList bitsValue_;
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public java.util.List<java.lang.String>
+ getBitsValueList() {
+ return bitsValue_;
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public int getBitsValueCount() {
+ return bitsValue_.size();
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public java.lang.String getBitsValue(int index) {
+ return bitsValue_.get(index);
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public com.google.protobuf.ByteString
+ getBitsValueBytes(int index) {
+ return bitsValue_.getByteString(index);
+ }
+
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
+ public static final int INSTANCEIDENTIFIERVALUE_FIELD_NUMBER = 8;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public boolean hasInstanceIdentifierValue() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+ return instanceIdentifierValue_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+ return instanceIdentifierValue_;
+ }
+
+ private void initFields() {
+ path_ = "";
+ type_ = "";
+ attributes_ = java.util.Collections.emptyList();
+ child_ = java.util.Collections.emptyList();
+ value_ = "";
+ valueType_ = "";
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ for (int i = 0; i < getAttributesCount(); i++) {
+ if (!getAttributes(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ for (int i = 0; i < getChildCount(); i++) {
+ if (!getChild(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ if (hasInstanceIdentifierValue()) {
+ if (!getInstanceIdentifierValue().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getTypeBytes());
+ }
+ for (int i = 0; i < attributes_.size(); i++) {
+ output.writeMessage(3, attributes_.get(i));
+ }
+ for (int i = 0; i < child_.size(); i++) {
+ output.writeMessage(4, child_.get(i));
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeBytes(5, getValueBytes());
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeBytes(6, getValueTypeBytes());
+ }
+ for (int i = 0; i < bitsValue_.size(); i++) {
+ output.writeBytes(7, bitsValue_.getByteString(i));
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeMessage(8, instanceIdentifierValue_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getTypeBytes());
+ }
+ for (int i = 0; i < attributes_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(3, attributes_.get(i));
+ }
+ for (int i = 0; i < child_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(4, child_.get(i));
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(5, getValueBytes());
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(6, getValueTypeBytes());
+ }
+ {
+ int dataSize = 0;
+ for (int i = 0; i < bitsValue_.size(); i++) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeBytesSizeNoTag(bitsValue_.getByteString(i));
+ }
+ size += dataSize;
+ size += 1 * getBitsValueList().size();
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(8, instanceIdentifierValue_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.Node}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getAttributesFieldBuilder();
+ getChildFieldBuilder();
+ getInstanceIdentifierValueFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ path_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ type_ = "";
+ bitField0_ = (bitField0_ & ~0x00000002);
+ if (attributesBuilder_ == null) {
+ attributes_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000004);
+ } else {
+ attributesBuilder_.clear();
+ }
+ if (childBuilder_ == null) {
+ child_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000008);
+ } else {
+ childBuilder_.clear();
+ }
+ value_ = "";
+ bitField0_ = (bitField0_ & ~0x00000010);
+ valueType_ = "";
+ bitField0_ = (bitField0_ & ~0x00000020);
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000040);
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierValueBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000080);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node build() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node buildPartial() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.path_ = path_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.type_ = type_;
+ if (attributesBuilder_ == null) {
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ attributes_ = java.util.Collections.unmodifiableList(attributes_);
+ bitField0_ = (bitField0_ & ~0x00000004);
+ }
+ result.attributes_ = attributes_;
+ } else {
+ result.attributes_ = attributesBuilder_.build();
+ }
+ if (childBuilder_ == null) {
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ child_ = java.util.Collections.unmodifiableList(child_);
+ bitField0_ = (bitField0_ & ~0x00000008);
+ }
+ result.child_ = child_;
+ } else {
+ result.child_ = childBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.value_ = value_;
+ if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ result.valueType_ = valueType_;
+ if (((bitField0_ & 0x00000040) == 0x00000040)) {
+ bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(
+ bitsValue_);
+ bitField0_ = (bitField0_ & ~0x00000040);
+ }
+ result.bitsValue_ = bitsValue_;
+ if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ if (instanceIdentifierValueBuilder_ == null) {
+ result.instanceIdentifierValue_ = instanceIdentifierValue_;
+ } else {
+ result.instanceIdentifierValue_ = instanceIdentifierValueBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node other) {
+ if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) return this;
+ if (other.hasPath()) {
+ bitField0_ |= 0x00000001;
+ path_ = other.path_;
+ onChanged();
+ }
+ if (other.hasType()) {
+ bitField0_ |= 0x00000002;
+ type_ = other.type_;
+ onChanged();
+ }
+ if (attributesBuilder_ == null) {
+ if (!other.attributes_.isEmpty()) {
+ if (attributes_.isEmpty()) {
+ attributes_ = other.attributes_;
+ bitField0_ = (bitField0_ & ~0x00000004);
+ } else {
+ ensureAttributesIsMutable();
+ attributes_.addAll(other.attributes_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.attributes_.isEmpty()) {
+ if (attributesBuilder_.isEmpty()) {
+ attributesBuilder_.dispose();
+ attributesBuilder_ = null;
+ attributes_ = other.attributes_;
+ bitField0_ = (bitField0_ & ~0x00000004);
+ attributesBuilder_ =
+ com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getAttributesFieldBuilder() : null;
+ } else {
+ attributesBuilder_.addAllMessages(other.attributes_);
+ }
+ }
+ }
+ if (childBuilder_ == null) {
+ if (!other.child_.isEmpty()) {
+ if (child_.isEmpty()) {
+ child_ = other.child_;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ } else {
+ ensureChildIsMutable();
+ child_.addAll(other.child_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.child_.isEmpty()) {
+ if (childBuilder_.isEmpty()) {
+ childBuilder_.dispose();
+ childBuilder_ = null;
+ child_ = other.child_;
+ bitField0_ = (bitField0_ & ~0x00000008);
+ childBuilder_ =
+ com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getChildFieldBuilder() : null;
+ } else {
+ childBuilder_.addAllMessages(other.child_);
+ }
+ }
+ }
+ if (other.hasValue()) {
+ bitField0_ |= 0x00000010;
+ value_ = other.value_;
+ onChanged();
+ }
+ if (other.hasValueType()) {
+ bitField0_ |= 0x00000020;
+ valueType_ = other.valueType_;
+ onChanged();
+ }
+ if (!other.bitsValue_.isEmpty()) {
+ if (bitsValue_.isEmpty()) {
+ bitsValue_ = other.bitsValue_;
+ bitField0_ = (bitField0_ & ~0x00000040);
+ } else {
+ ensureBitsValueIsMutable();
+ bitsValue_.addAll(other.bitsValue_);
+ }
+ onChanged();
+ }
+ if (other.hasInstanceIdentifierValue()) {
+ mergeInstanceIdentifierValue(other.getInstanceIdentifierValue());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ for (int i = 0; i < getAttributesCount(); i++) {
+ if (!getAttributes(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ for (int i = 0; i < getChildCount(); i++) {
+ if (!getChild(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ if (hasInstanceIdentifierValue()) {
+ if (!getInstanceIdentifierValue().isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // optional string path = 1;
+ private java.lang.Object path_ = "";
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public boolean hasPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public java.lang.String getPath() {
+ java.lang.Object ref = path_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ path_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getPathBytes() {
+ java.lang.Object ref = path_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ path_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public Builder setPath(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ path_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public Builder clearPath() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ path_ = getDefaultInstance().getPath();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string path = 1;</code>
+ */
+ public Builder setPathBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ path_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional string type = 2;
+ private java.lang.Object type_ = "";
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ type_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public Builder setType(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public Builder clearType() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ type_ = getDefaultInstance().getType();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string type = 2;</code>
+ */
+ public Builder setTypeBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_ =
+ java.util.Collections.emptyList();
+ private void ensureAttributesIsMutable() {
+ if (!((bitField0_ & 0x00000004) == 0x00000004)) {
+ attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>(attributes_);
+ bitField0_ |= 0x00000004;
+ }
+ }
+
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_;
+
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
+ if (attributesBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(attributes_);
+ } else {
+ return attributesBuilder_.getMessageList();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public int getAttributesCount() {
+ if (attributesBuilder_ == null) {
+ return attributes_.size();
+ } else {
+ return attributesBuilder_.getCount();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
+ if (attributesBuilder_ == null) {
+ return attributes_.get(index);
+ } else {
+ return attributesBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder setAttributes(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+ if (attributesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAttributesIsMutable();
+ attributes_.set(index, value);
+ onChanged();
+ } else {
+ attributesBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder setAttributes(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ attributes_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ attributesBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+ if (attributesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAttributesIsMutable();
+ attributes_.add(value);
+ onChanged();
+ } else {
+ attributesBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder addAttributes(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+ if (attributesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureAttributesIsMutable();
+ attributes_.add(index, value);
+ onChanged();
+ } else {
+ attributesBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder addAttributes(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ attributes_.add(builderForValue.build());
+ onChanged();
+ } else {
+ attributesBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder addAttributes(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ attributes_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ attributesBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder addAllAttributes(
+ java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> values) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ super.addAll(values, attributes_);
+ onChanged();
+ } else {
+ attributesBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder clearAttributes() {
+ if (attributesBuilder_ == null) {
+ attributes_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000004);
+ onChanged();
+ } else {
+ attributesBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public Builder removeAttributes(int index) {
+ if (attributesBuilder_ == null) {
+ ensureAttributesIsMutable();
+ attributes_.remove(index);
+ onChanged();
+ } else {
+ attributesBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder(
+ int index) {
+ return getAttributesFieldBuilder().getBuilder(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+ int index) {
+ if (attributesBuilder_ == null) {
+ return attributes_.get(index); } else {
+ return attributesBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ getAttributesOrBuilderList() {
+ if (attributesBuilder_ != null) {
+ return attributesBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(attributes_);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() {
+ return getAttributesFieldBuilder().addBuilder(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder(
+ int index) {
+ return getAttributesFieldBuilder().addBuilder(
+ index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder>
+ getAttributesBuilderList() {
+ return getAttributesFieldBuilder().getBuilderList();
+ }
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ getAttributesFieldBuilder() {
+ if (attributesBuilder_ == null) {
+ attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>(
+ attributes_,
+ ((bitField0_ & 0x00000004) == 0x00000004),
+ getParentForChildren(),
+ isClean());
+ attributes_ = null;
+ }
+ return attributesBuilder_;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.Node child = 4;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> child_ =
+ java.util.Collections.emptyList();
+ private void ensureChildIsMutable() {
+ if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+ child_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>(child_);
+ bitField0_ |= 0x00000008;
+ }
+ }
+
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> childBuilder_;
+
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> getChildList() {
+ if (childBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(child_);
+ } else {
+ return childBuilder_.getMessageList();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public int getChildCount() {
+ if (childBuilder_ == null) {
+ return child_.size();
+ } else {
+ return childBuilder_.getCount();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) {
+ if (childBuilder_ == null) {
+ return child_.get(index);
+ } else {
+ return childBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder setChild(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (childBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureChildIsMutable();
+ child_.set(index, value);
+ onChanged();
+ } else {
+ childBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder setChild(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (childBuilder_ == null) {
+ ensureChildIsMutable();
+ child_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ childBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder addChild(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (childBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureChildIsMutable();
+ child_.add(value);
+ onChanged();
+ } else {
+ childBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder addChild(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (childBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureChildIsMutable();
+ child_.add(index, value);
+ onChanged();
+ } else {
+ childBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder addChild(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (childBuilder_ == null) {
+ ensureChildIsMutable();
+ child_.add(builderForValue.build());
+ onChanged();
+ } else {
+ childBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder addChild(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (childBuilder_ == null) {
+ ensureChildIsMutable();
+ child_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ childBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder addAllChild(
+ java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> values) {
+ if (childBuilder_ == null) {
+ ensureChildIsMutable();
+ super.addAll(values, child_);
+ onChanged();
+ } else {
+ childBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder clearChild() {
+ if (childBuilder_ == null) {
+ child_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000008);
+ onChanged();
+ } else {
+ childBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public Builder removeChild(int index) {
+ if (childBuilder_ == null) {
+ ensureChildIsMutable();
+ child_.remove(index);
+ onChanged();
+ } else {
+ childBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getChildBuilder(
+ int index) {
+ return getChildFieldBuilder().getBuilder(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
+ int index) {
+ if (childBuilder_ == null) {
+ return child_.get(index); } else {
+ return childBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getChildOrBuilderList() {
+ if (childBuilder_ != null) {
+ return childBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(child_);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder() {
+ return getChildFieldBuilder().addBuilder(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder(
+ int index) {
+ return getChildFieldBuilder().addBuilder(
+ index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder>
+ getChildBuilderList() {
+ return getChildFieldBuilder().getBuilderList();
+ }
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getChildFieldBuilder() {
+ if (childBuilder_ == null) {
+ childBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+ child_,
+ ((bitField0_ & 0x00000008) == 0x00000008),
+ getParentForChildren(),
+ isClean());
+ child_ = null;
+ }
+ return childBuilder_;
+ }
+
+ // optional string value = 5;
+ private java.lang.Object value_ = "";
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ value_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public Builder setValue(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000010;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000010);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string value = 5;</code>
+ */
+ public Builder setValueBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000010;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional string valueType = 6;
+ private java.lang.Object valueType_ = "";
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public boolean hasValueType() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
+ }
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public java.lang.String getValueType() {
+ java.lang.Object ref = valueType_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ valueType_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueTypeBytes() {
+ java.lang.Object ref = valueType_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ valueType_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public Builder setValueType(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000020;
+ valueType_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public Builder clearValueType() {
+ bitField0_ = (bitField0_ & ~0x00000020);
+ valueType_ = getDefaultInstance().getValueType();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string valueType = 6;</code>
+ */
+ public Builder setValueTypeBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000020;
+ valueType_ = value;
+ onChanged();
+ return this;
+ }
+
+ // repeated string bitsValue = 7;
+ private com.google.protobuf.LazyStringList bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ private void ensureBitsValueIsMutable() {
+ if (!((bitField0_ & 0x00000040) == 0x00000040)) {
+ bitsValue_ = new com.google.protobuf.LazyStringArrayList(bitsValue_);
+ bitField0_ |= 0x00000040;
+ }
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public java.util.List<java.lang.String>
+ getBitsValueList() {
+ return java.util.Collections.unmodifiableList(bitsValue_);
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public int getBitsValueCount() {
+ return bitsValue_.size();
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public java.lang.String getBitsValue(int index) {
+ return bitsValue_.get(index);
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public com.google.protobuf.ByteString
+ getBitsValueBytes(int index) {
+ return bitsValue_.getByteString(index);
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public Builder setBitsValue(
+ int index, java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureBitsValueIsMutable();
+ bitsValue_.set(index, value);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public Builder addBitsValue(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureBitsValueIsMutable();
+ bitsValue_.add(value);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public Builder addAllBitsValue(
+ java.lang.Iterable<java.lang.String> values) {
+ ensureBitsValueIsMutable();
+ super.addAll(values, bitsValue_);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public Builder clearBitsValue() {
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000040);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated string bitsValue = 7;</code>
+ */
+ public Builder addBitsValueBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureBitsValueIsMutable();
+ bitsValue_.add(value);
+ onChanged();
+ return this;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierValueBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public boolean hasInstanceIdentifierValue() {
+ return ((bitField0_ & 0x00000080) == 0x00000080);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ return instanceIdentifierValue_;
+ } else {
+ return instanceIdentifierValueBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public Builder setInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierValue_ = value;
+ onChanged();
+ } else {
+ instanceIdentifierValueBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000080;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public Builder setInstanceIdentifierValue(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = builderForValue.build();
+ onChanged();
+ } else {
+ instanceIdentifierValueBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000080;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public Builder mergeInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ if (((bitField0_ & 0x00000080) == 0x00000080) &&
+ instanceIdentifierValue_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierValue_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierValue_).mergeFrom(value).buildPartial();
+ } else {
+ instanceIdentifierValue_ = value;
+ }
+ onChanged();
+ } else {
+ instanceIdentifierValueBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000080;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public Builder clearInstanceIdentifierValue() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ onChanged();
+ } else {
+ instanceIdentifierValueBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000080);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierValueBuilder() {
+ bitField0_ |= 0x00000080;
+ onChanged();
+ return getInstanceIdentifierValueFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+ if (instanceIdentifierValueBuilder_ != null) {
+ return instanceIdentifierValueBuilder_.getMessageOrBuilder();
+ } else {
+ return instanceIdentifierValue_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierValueFieldBuilder() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValueBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierValue_,
+ getParentForChildren(),
+ isClean());
+ instanceIdentifierValue_ = null;
+ }
+ return instanceIdentifierValueBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Node)
+ }
+
+ static {
+ defaultInstance = new Node(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Node)
+ }
+
+ public interface ContainerOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string parentPath = 1;
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ boolean hasParentPath();
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ java.lang.String getParentPath();
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getParentPathBytes();
+
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ boolean hasNormalizedNode();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.Container}
+ */
+ public static final class Container extends
+ com.google.protobuf.GeneratedMessage
+ implements ContainerOrBuilder {
+ // Use Container.newBuilder() to construct.
+ private Container(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private Container(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final Container defaultInstance;
+ public static Container getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Container getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private Container(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ parentPath_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ subBuilder = normalizedNode_.toBuilder();
+ }
+ normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(normalizedNode_);
+ normalizedNode_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000002;
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<Container> PARSER =
+ new com.google.protobuf.AbstractParser<Container>() {
+ public Container parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new Container(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<Container> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string parentPath = 1;
+ public static final int PARENTPATH_FIELD_NUMBER = 1;
+ private java.lang.Object parentPath_;
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public boolean hasParentPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public java.lang.String getParentPath() {
+ java.lang.Object ref = parentPath_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ parentPath_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getParentPathBytes() {
+ java.lang.Object ref = parentPath_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ parentPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public boolean hasNormalizedNode() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+ return normalizedNode_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+ return normalizedNode_;
+ }
+
+ private void initFields() {
+ parentPath_ = "";
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasParentPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (hasNormalizedNode()) {
+ if (!getNormalizedNode().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getParentPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeMessage(2, normalizedNode_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getParentPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(2, normalizedNode_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.Container}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.ContainerOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getNormalizedNodeFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ parentPath_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ } else {
+ normalizedNodeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container build() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container buildPartial() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.parentPath_ = parentPath_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ if (normalizedNodeBuilder_ == null) {
+ result.normalizedNode_ = normalizedNode_;
+ } else {
+ result.normalizedNode_ = normalizedNodeBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container other) {
+ if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.getDefaultInstance()) return this;
+ if (other.hasParentPath()) {
+ bitField0_ |= 0x00000001;
+ parentPath_ = other.parentPath_;
+ onChanged();
+ }
+ if (other.hasNormalizedNode()) {
+ mergeNormalizedNode(other.getNormalizedNode());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasParentPath()) {
+
+ return false;
+ }
+ if (hasNormalizedNode()) {
+ if (!getNormalizedNode().isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string parentPath = 1;
+ private java.lang.Object parentPath_ = "";
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public boolean hasParentPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public java.lang.String getParentPath() {
+ java.lang.Object ref = parentPath_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ parentPath_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getParentPathBytes() {
+ java.lang.Object ref = parentPath_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ parentPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public Builder setParentPath(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ parentPath_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public Builder clearParentPath() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ parentPath_ = getDefaultInstance().getParentPath();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string parentPath = 1;</code>
+ */
+ public Builder setParentPathBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ parentPath_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public boolean hasNormalizedNode() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+ if (normalizedNodeBuilder_ == null) {
+ return normalizedNode_;
+ } else {
+ return normalizedNodeBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (normalizedNodeBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ normalizedNode_ = value;
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder setNormalizedNode(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = builderForValue.build();
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (normalizedNodeBuilder_ == null) {
+ if (((bitField0_ & 0x00000002) == 0x00000002) &&
+ normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+ normalizedNode_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+ } else {
+ normalizedNode_ = value;
+ }
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder clearNormalizedNode() {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
+ bitField0_ |= 0x00000002;
+ onChanged();
+ return getNormalizedNodeFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+ if (normalizedNodeBuilder_ != null) {
+ return normalizedNodeBuilder_.getMessageOrBuilder();
+ } else {
+ return normalizedNode_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getNormalizedNodeFieldBuilder() {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+ normalizedNode_,
+ getParentForChildren(),
+ isClean());
+ normalizedNode_ = null;
+ }
+ return normalizedNodeBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Container)
+ }
+
+ static {
+ defaultInstance = new Container(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Container)
+ }
+
+ public interface NodeMapEntryOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ boolean hasInstanceIdentifierPath();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder();
+
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ boolean hasNormalizedNode();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMapEntry}
+ */
+ public static final class NodeMapEntry extends
+ com.google.protobuf.GeneratedMessage
+ implements NodeMapEntryOrBuilder {
+ // Use NodeMapEntry.newBuilder() to construct.
+ private NodeMapEntry(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private NodeMapEntry(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final NodeMapEntry defaultInstance;
+ public static NodeMapEntry getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public NodeMapEntry getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private NodeMapEntry(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ subBuilder = instanceIdentifierPath_.toBuilder();
+ }
+ instanceIdentifierPath_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierPath_);
+ instanceIdentifierPath_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000001;
+ break;
+ }
+ case 18: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ subBuilder = normalizedNode_.toBuilder();
+ }
+ normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(normalizedNode_);
+ normalizedNode_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000002;
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<NodeMapEntry> PARSER =
+ new com.google.protobuf.AbstractParser<NodeMapEntry>() {
+ public NodeMapEntry parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new NodeMapEntry(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<NodeMapEntry> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+ public static final int INSTANCEIDENTIFIERPATH_FIELD_NUMBER = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public boolean hasInstanceIdentifierPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() {
+ return instanceIdentifierPath_;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() {
+ return instanceIdentifierPath_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public boolean hasNormalizedNode() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+ return normalizedNode_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+ return normalizedNode_;
+ }
+
+ private void initFields() {
+ instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasInstanceIdentifierPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!getInstanceIdentifierPath().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (hasNormalizedNode()) {
+ if (!getNormalizedNode().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeMessage(1, instanceIdentifierPath_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeMessage(2, normalizedNode_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, instanceIdentifierPath_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(2, normalizedNode_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMapEntry}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getInstanceIdentifierPathFieldBuilder();
+ getNormalizedNodeFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ if (instanceIdentifierPathBuilder_ == null) {
+ instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierPathBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ } else {
+ normalizedNodeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry build() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry buildPartial() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ if (instanceIdentifierPathBuilder_ == null) {
+ result.instanceIdentifierPath_ = instanceIdentifierPath_;
+ } else {
+ result.instanceIdentifierPath_ = instanceIdentifierPathBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ if (normalizedNodeBuilder_ == null) {
+ result.normalizedNode_ = normalizedNode_;
+ } else {
+ result.normalizedNode_ = normalizedNodeBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry other) {
+ if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance()) return this;
+ if (other.hasInstanceIdentifierPath()) {
+ mergeInstanceIdentifierPath(other.getInstanceIdentifierPath());
+ }
+ if (other.hasNormalizedNode()) {
+ mergeNormalizedNode(other.getNormalizedNode());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasInstanceIdentifierPath()) {
+
+ return false;
+ }
+ if (!getInstanceIdentifierPath().isInitialized()) {
+
+ return false;
+ }
+ if (hasNormalizedNode()) {
+ if (!getNormalizedNode().isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathBuilder_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public boolean hasInstanceIdentifierPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() {
+ if (instanceIdentifierPathBuilder_ == null) {
+ return instanceIdentifierPath_;
+ } else {
+ return instanceIdentifierPathBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public Builder setInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierPath_ = value;
+ onChanged();
+ } else {
+ instanceIdentifierPathBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public Builder setInstanceIdentifierPath(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierPathBuilder_ == null) {
+ instanceIdentifierPath_ = builderForValue.build();
+ onChanged();
+ } else {
+ instanceIdentifierPathBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public Builder mergeInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ instanceIdentifierPath_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierPath_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPath_).mergeFrom(value).buildPartial();
+ } else {
+ instanceIdentifierPath_ = value;
+ }
+ onChanged();
+ } else {
+ instanceIdentifierPathBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public Builder clearInstanceIdentifierPath() {
+ if (instanceIdentifierPathBuilder_ == null) {
+ instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ onChanged();
+ } else {
+ instanceIdentifierPathBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathBuilder() {
+ bitField0_ |= 0x00000001;
+ onChanged();
+ return getInstanceIdentifierPathFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() {
+ if (instanceIdentifierPathBuilder_ != null) {
+ return instanceIdentifierPathBuilder_.getMessageOrBuilder();
+ } else {
+ return instanceIdentifierPath_;
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierPathFieldBuilder() {
+ if (instanceIdentifierPathBuilder_ == null) {
+ instanceIdentifierPathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierPath_,
+ getParentForChildren(),
+ isClean());
+ instanceIdentifierPath_ = null;
+ }
+ return instanceIdentifierPathBuilder_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public boolean hasNormalizedNode() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+ if (normalizedNodeBuilder_ == null) {
+ return normalizedNode_;
+ } else {
+ return normalizedNodeBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (normalizedNodeBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ normalizedNode_ = value;
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder setNormalizedNode(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = builderForValue.build();
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (normalizedNodeBuilder_ == null) {
+ if (((bitField0_ & 0x00000002) == 0x00000002) &&
+ normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+ normalizedNode_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+ } else {
+ normalizedNode_ = value;
+ }
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder clearNormalizedNode() {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
+ bitField0_ |= 0x00000002;
+ onChanged();
+ return getNormalizedNodeFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+ if (normalizedNodeBuilder_ != null) {
+ return normalizedNodeBuilder_.getMessageOrBuilder();
+ } else {
+ return normalizedNode_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getNormalizedNodeFieldBuilder() {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+ normalizedNode_,
+ getParentForChildren(),
+ isClean());
+ normalizedNode_ = null;
+ }
+ return normalizedNodeBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.NodeMapEntry)
+ }
+
+ static {
+ defaultInstance = new NodeMapEntry(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.NodeMapEntry)
+ }
+
+ public interface NodeMapOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry>
+ getMapEntriesList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index);
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ int getMapEntriesCount();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
+ getMapEntriesOrBuilderList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder(
+ int index);
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMap}
+ */
+ public static final class NodeMap extends
+ com.google.protobuf.GeneratedMessage
+ implements NodeMapOrBuilder {
+ // Use NodeMap.newBuilder() to construct.
+ private NodeMap(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private NodeMap(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final NodeMap defaultInstance;
+ public static NodeMap getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public NodeMap getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private NodeMap(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ mapEntries_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry>();
+ mutable_bitField0_ |= 0x00000001;
+ }
+ mapEntries_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.PARSER, extensionRegistry));
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ mapEntries_ = java.util.Collections.unmodifiableList(mapEntries_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<NodeMap> PARSER =
+ new com.google.protobuf.AbstractParser<NodeMap>() {
+ public NodeMap parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new NodeMap(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<NodeMap> getParserForType() {
+ return PARSER;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;
+ public static final int MAPENTRIES_FIELD_NUMBER = 1;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> mapEntries_;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> getMapEntriesList() {
+ return mapEntries_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
+ getMapEntriesOrBuilderList() {
+ return mapEntries_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public int getMapEntriesCount() {
+ return mapEntries_.size();
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index) {
+ return mapEntries_.get(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder(
+ int index) {
+ return mapEntries_.get(index);
+ }
+
+ private void initFields() {
+ mapEntries_ = java.util.Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ for (int i = 0; i < getMapEntriesCount(); i++) {
+ if (!getMapEntries(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ for (int i = 0; i < mapEntries_.size(); i++) {
+ output.writeMessage(1, mapEntries_.get(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ for (int i = 0; i < mapEntries_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, mapEntries_.get(i));
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMap}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getMapEntriesFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ if (mapEntriesBuilder_ == null) {
+ mapEntries_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ mapEntriesBuilder_.clear();
+ }
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap build() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap buildPartial() {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap(this);
+ int from_bitField0_ = bitField0_;
+ if (mapEntriesBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ mapEntries_ = java.util.Collections.unmodifiableList(mapEntries_);
+ bitField0_ = (bitField0_ & ~0x00000001);
+ }
+ result.mapEntries_ = mapEntries_;
+ } else {
+ result.mapEntries_ = mapEntriesBuilder_.build();
+ }
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap other) {
+ if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) return this;
+ if (mapEntriesBuilder_ == null) {
+ if (!other.mapEntries_.isEmpty()) {
+ if (mapEntries_.isEmpty()) {
+ mapEntries_ = other.mapEntries_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ ensureMapEntriesIsMutable();
+ mapEntries_.addAll(other.mapEntries_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.mapEntries_.isEmpty()) {
+ if (mapEntriesBuilder_.isEmpty()) {
+ mapEntriesBuilder_.dispose();
+ mapEntriesBuilder_ = null;
+ mapEntries_ = other.mapEntries_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ mapEntriesBuilder_ =
+ com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getMapEntriesFieldBuilder() : null;
+ } else {
+ mapEntriesBuilder_.addAllMessages(other.mapEntries_);
+ }
+ }
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ for (int i = 0; i < getMapEntriesCount(); i++) {
+ if (!getMapEntries(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> mapEntries_ =
+ java.util.Collections.emptyList();
+ private void ensureMapEntriesIsMutable() {
+ if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+ mapEntries_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry>(mapEntries_);
+ bitField0_ |= 0x00000001;
+ }
+ }
+
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder> mapEntriesBuilder_;
+
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> getMapEntriesList() {
+ if (mapEntriesBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(mapEntries_);
+ } else {
+ return mapEntriesBuilder_.getMessageList();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public int getMapEntriesCount() {
+ if (mapEntriesBuilder_ == null) {
+ return mapEntries_.size();
+ } else {
+ return mapEntriesBuilder_.getCount();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index) {
+ if (mapEntriesBuilder_ == null) {
+ return mapEntries_.get(index);
+ } else {
+ return mapEntriesBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder setMapEntries(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) {
+ if (mapEntriesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureMapEntriesIsMutable();
+ mapEntries_.set(index, value);
+ onChanged();
+ } else {
+ mapEntriesBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder setMapEntries(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) {
+ if (mapEntriesBuilder_ == null) {
+ ensureMapEntriesIsMutable();
+ mapEntries_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ mapEntriesBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder addMapEntries(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) {
+ if (mapEntriesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureMapEntriesIsMutable();
+ mapEntries_.add(value);
+ onChanged();
+ } else {
+ mapEntriesBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder addMapEntries(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) {
+ if (mapEntriesBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureMapEntriesIsMutable();
+ mapEntries_.add(index, value);
+ onChanged();
+ } else {
+ mapEntriesBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder addMapEntries(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) {
+ if (mapEntriesBuilder_ == null) {
+ ensureMapEntriesIsMutable();
+ mapEntries_.add(builderForValue.build());
+ onChanged();
+ } else {
+ mapEntriesBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder addMapEntries(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) {
+ if (mapEntriesBuilder_ == null) {
+ ensureMapEntriesIsMutable();
+ mapEntries_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ mapEntriesBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder addAllMapEntries(
+ java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> values) {
+ if (mapEntriesBuilder_ == null) {
+ ensureMapEntriesIsMutable();
+ super.addAll(values, mapEntries_);
+ onChanged();
+ } else {
+ mapEntriesBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder clearMapEntries() {
+ if (mapEntriesBuilder_ == null) {
+ mapEntries_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ onChanged();
+ } else {
+ mapEntriesBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public Builder removeMapEntries(int index) {
+ if (mapEntriesBuilder_ == null) {
+ ensureMapEntriesIsMutable();
+ mapEntries_.remove(index);
+ onChanged();
+ } else {
+ mapEntriesBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder getMapEntriesBuilder(
+ int index) {
+ return getMapEntriesFieldBuilder().getBuilder(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder(
+ int index) {
+ if (mapEntriesBuilder_ == null) {
+ return mapEntries_.get(index); } else {
+ return mapEntriesBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
+ getMapEntriesOrBuilderList() {
+ if (mapEntriesBuilder_ != null) {
+ return mapEntriesBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(mapEntries_);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder addMapEntriesBuilder() {
+ return getMapEntriesFieldBuilder().addBuilder(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder addMapEntriesBuilder(
+ int index) {
+ return getMapEntriesFieldBuilder().addBuilder(
+ index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder>
+ getMapEntriesBuilderList() {
+ return getMapEntriesFieldBuilder().getBuilderList();
+ }
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
+ getMapEntriesFieldBuilder() {
+ if (mapEntriesBuilder_ == null) {
+ mapEntriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>(
+ mapEntries_,
+ ((bitField0_ & 0x00000001) == 0x00000001),
+ getParentForChildren(),
+ isClean());
+ mapEntries_ = null;
+ }
+ return mapEntriesBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.NodeMap)
+ }
+
+ static {
+ defaultInstance = new NodeMap(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.NodeMap)
+ }
+
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_Node_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_Container_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\014Common.proto\022!org.opendaylight.control" +
+ "ler.mdsal\"6\n\tAttribute\022\014\n\004name\030\001 \002(\t\022\r\n\005" +
+ "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"\026\n\005QName\022\r\n\005va" +
+ "lue\030\001 \002(\t\"\251\001\n\014PathArgument\022\r\n\005value\030\001 \002(" +
+ "\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeType\030\003 \001(\0132(.org." +
+ "opendaylight.controller.mdsal.QName\022@\n\na" +
+ "ttributes\030\004 \003(\0132,.org.opendaylight.contr" +
+ "oller.mdsal.Attribute\"X\n\022InstanceIdentif" +
+ "ier\022B\n\targuments\030\001 \003(\0132/.org.opendayligh" +
+ "t.controller.mdsal.PathArgument\"\251\002\n\004Node",
+ "\022\014\n\004path\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022@\n\nattribut" +
+ "es\030\003 \003(\0132,.org.opendaylight.controller.m" +
+ "dsal.Attribute\0226\n\005child\030\004 \003(\0132\'.org.open" +
+ "daylight.controller.mdsal.Node\022\r\n\005value\030" +
+ "\005 \001(\t\022\021\n\tvalueType\030\006 \001(\t\022\021\n\tbitsValue\030\007 " +
+ "\003(\t\022V\n\027instanceIdentifierValue\030\010 \001(\01325.o" +
+ "rg.opendaylight.controller.mdsal.Instanc" +
+ "eIdentifier\"`\n\tContainer\022\022\n\nparentPath\030\001" +
+ " \002(\t\022?\n\016normalizedNode\030\002 \001(\0132\'.org.opend" +
+ "aylight.controller.mdsal.Node\"\246\001\n\014NodeMa",
+ "pEntry\022U\n\026instanceIdentifierPath\030\001 \002(\01325" +
+ ".org.opendaylight.controller.mdsal.Insta" +
+ "nceIdentifier\022?\n\016normalizedNode\030\002 \001(\0132\'." +
+ "org.opendaylight.controller.mdsal.Node\"N" +
+ "\n\007NodeMap\022C\n\nmapEntries\030\001 \003(\0132/.org.open" +
+ "daylight.controller.mdsal.NodeMapEntryBO" +
+ "\n5org.opendaylight.controller.protobuff." +
+ "messages.commonB\026NormalizedNodeMessages"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor,
+ new java.lang.String[] { "Name", "Value", "Type", });
+ internal_static_org_opendaylight_controller_mdsal_QName_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_QName_descriptor,
+ new java.lang.String[] { "Value", });
+ internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor =
+ getDescriptor().getMessageTypes().get(2);
+ internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor,
+ new java.lang.String[] { "Value", "Type", "NodeType", "Attributes", });
+ internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor =
+ getDescriptor().getMessageTypes().get(3);
+ internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor,
+ new java.lang.String[] { "Arguments", });
+ internal_static_org_opendaylight_controller_mdsal_Node_descriptor =
+ getDescriptor().getMessageTypes().get(4);
+ internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_Node_descriptor,
+ new java.lang.String[] { "Path", "Type", "Attributes", "Child", "Value", "ValueType", "BitsValue", "InstanceIdentifierValue", });
+ internal_static_org_opendaylight_controller_mdsal_Container_descriptor =
+ getDescriptor().getMessageTypes().get(5);
+ internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_Container_descriptor,
+ new java.lang.String[] { "ParentPath", "NormalizedNode", });
+ internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor =
+ getDescriptor().getMessageTypes().get(6);
+ internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor,
+ new java.lang.String[] { "InstanceIdentifierPath", "NormalizedNode", });
+ internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor =
+ getDescriptor().getMessageTypes().get(7);
+ internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor,
+ new java.lang.String[] { "MapEntries", });
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getNodeIdentifierBytes() {
java.lang.Object ref = nodeIdentifier_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
nodeIdentifier_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getXmlStringBytes() {
java.lang.Object ref = xmlString_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
xmlString_ = b;
public final boolean isInitialized() {
if (!hasNodeIdentifier()) {
-
+
return false;
}
if (!hasXmlString()) {
-
+
return false;
}
return true;
getNodeIdentifierBytes() {
java.lang.Object ref = nodeIdentifier_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
nodeIdentifier_ = b;
getXmlStringBytes() {
java.lang.Object ref = xmlString_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
xmlString_ = b;
public interface DataChangedOrBuilder
extends com.google.protobuf.MessageOrBuilder {
- // repeated string instanceIdentifierPathArguments = 1;
+ // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList();
+ boolean hasOriginalSubTree();
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- int getInstanceIdentifierPathArgumentsCount();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree();
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- java.lang.String getInstanceIdentifierPathArguments(int index);
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder();
+
+ // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
+ */
+ boolean hasUpdatedSubTree();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder();
+
+ // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ boolean hasOriginalData();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder();
+
+ // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ boolean hasUpdatedData();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder();
+
+ // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ boolean hasCreatedData();
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
*/
- com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index);
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder();
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;
+ // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier>
+ getRemovedPathsList();
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- boolean hasNormalizedNodeXml();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index);
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml();
+ int getRemovedPathsCount();
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder();
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getRemovedPathsOrBuilderList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder(
+ int index);
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.DataChanged}
break;
}
case 10: {
- if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
- mutable_bitField0_ |= 0x00000001;
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ subBuilder = originalSubTree_.toBuilder();
+ }
+ originalSubTree_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(originalSubTree_);
+ originalSubTree_ = subBuilder.buildPartial();
}
- instanceIdentifierPathArguments_.add(input.readBytes());
+ bitField0_ |= 0x00000001;
break;
}
case 18: {
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- subBuilder = normalizedNodeXml_.toBuilder();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ subBuilder = updatedSubTree_.toBuilder();
}
- normalizedNodeXml_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+ updatedSubTree_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
if (subBuilder != null) {
- subBuilder.mergeFrom(normalizedNodeXml_);
- normalizedNodeXml_ = subBuilder.buildPartial();
+ subBuilder.mergeFrom(updatedSubTree_);
+ updatedSubTree_ = subBuilder.buildPartial();
}
- bitField0_ |= 0x00000001;
+ bitField0_ |= 0x00000002;
+ break;
+ }
+ case 26: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ subBuilder = originalData_.toBuilder();
+ }
+ originalData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(originalData_);
+ originalData_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000004;
+ break;
+ }
+ case 34: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ subBuilder = updatedData_.toBuilder();
+ }
+ updatedData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(updatedData_);
+ updatedData_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000008;
+ break;
+ }
+ case 42: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ subBuilder = createdData_.toBuilder();
+ }
+ createdData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(createdData_);
+ createdData_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000010;
+ break;
+ }
+ case 50: {
+ if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
+ removedPaths_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier>();
+ mutable_bitField0_ |= 0x00000020;
+ }
+ removedPaths_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry));
break;
}
}
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
- if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
+ if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
+ removedPaths_ = java.util.Collections.unmodifiableList(removedPaths_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
private int bitField0_;
- // repeated string instanceIdentifierPathArguments = 1;
- public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
- private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_;
+ // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;
+ public static final int ORIGINALSUBTREE_FIELD_NUMBER = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node originalSubTree_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
+ */
+ public boolean hasOriginalSubTree() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree() {
+ return originalSubTree_;
+ }
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList() {
- return instanceIdentifierPathArguments_;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder() {
+ return originalSubTree_;
}
+
+ // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;
+ public static final int UPDATEDSUBTREE_FIELD_NUMBER = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node updatedSubTree_;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public int getInstanceIdentifierPathArgumentsCount() {
- return instanceIdentifierPathArguments_.size();
+ public boolean hasUpdatedSubTree() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public java.lang.String getInstanceIdentifierPathArguments(int index) {
- return instanceIdentifierPathArguments_.get(index);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree() {
+ return updatedSubTree_;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index) {
- return instanceIdentifierPathArguments_.getByteString(index);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder() {
+ return updatedSubTree_;
}
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;
- public static final int NORMALIZEDNODEXML_FIELD_NUMBER = 2;
- private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNodeXml_;
+ // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;
+ public static final int ORIGINALDATA_FIELD_NUMBER = 3;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap originalData_;
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
*/
- public boolean hasNormalizedNodeXml() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
+ public boolean hasOriginalData() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData() {
+ return originalData_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder() {
+ return originalData_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;
+ public static final int UPDATEDDATA_FIELD_NUMBER = 4;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap updatedData_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public boolean hasUpdatedData() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData() {
+ return updatedData_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder() {
+ return updatedData_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;
+ public static final int CREATEDDATA_FIELD_NUMBER = 5;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap createdData_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public boolean hasCreatedData() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData() {
+ return createdData_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder() {
+ return createdData_;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;
+ public static final int REMOVEDPATHS_FIELD_NUMBER = 6;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> removedPaths_;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> getRemovedPathsList() {
+ return removedPaths_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getRemovedPathsOrBuilderList() {
+ return removedPaths_;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml() {
- return normalizedNodeXml_;
+ public int getRemovedPathsCount() {
+ return removedPaths_.size();
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder() {
- return normalizedNodeXml_;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index) {
+ return removedPaths_.get(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder(
+ int index) {
+ return removedPaths_.get(index);
}
private void initFields() {
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ removedPaths_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
- if (!hasNormalizedNodeXml()) {
- memoizedIsInitialized = 0;
- return false;
+ if (hasOriginalSubTree()) {
+ if (!getOriginalSubTree().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ if (hasUpdatedSubTree()) {
+ if (!getUpdatedSubTree().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ if (hasOriginalData()) {
+ if (!getOriginalData().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ if (hasUpdatedData()) {
+ if (!getUpdatedData().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ if (hasCreatedData()) {
+ if (!getCreatedData().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
}
- if (!getNormalizedNodeXml().isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
+ for (int i = 0; i < getRemovedPathsCount(); i++) {
+ if (!getRemovedPaths(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
}
memoizedIsInitialized = 1;
return true;
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
- for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
- output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i));
- }
if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeMessage(2, normalizedNodeXml_);
+ output.writeMessage(1, originalSubTree_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeMessage(2, updatedSubTree_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeMessage(3, originalData_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeMessage(4, updatedData_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeMessage(5, createdData_);
+ }
+ for (int i = 0; i < removedPaths_.size(); i++) {
+ output.writeMessage(6, removedPaths_.get(i));
}
getUnknownFields().writeTo(output);
}
if (size != -1) return size;
size = 0;
- {
- int dataSize = 0;
- for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
- dataSize += com.google.protobuf.CodedOutputStream
- .computeBytesSizeNoTag(instanceIdentifierPathArguments_.getByteString(i));
- }
- size += dataSize;
- size += 1 * getInstanceIdentifierPathArgumentsList().size();
- }
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(2, normalizedNodeXml_);
+ .computeMessageSize(1, originalSubTree_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(2, updatedSubTree_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(3, originalData_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(4, updatedData_);
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(5, createdData_);
+ }
+ for (int i = 0; i < removedPaths_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(6, removedPaths_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
- getNormalizedNodeXmlFieldBuilder();
+ getOriginalSubTreeFieldBuilder();
+ getUpdatedSubTreeFieldBuilder();
+ getOriginalDataFieldBuilder();
+ getUpdatedDataFieldBuilder();
+ getCreatedDataFieldBuilder();
+ getRemovedPathsFieldBuilder();
}
}
private static Builder create() {
public Builder clear() {
super.clear();
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ if (originalSubTreeBuilder_ == null) {
+ originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ } else {
+ originalSubTreeBuilder_.clear();
+ }
bitField0_ = (bitField0_ & ~0x00000001);
- if (normalizedNodeXmlBuilder_ == null) {
- normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ if (updatedSubTreeBuilder_ == null) {
+ updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
} else {
- normalizedNodeXmlBuilder_.clear();
+ updatedSubTreeBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
+ if (originalDataBuilder_ == null) {
+ originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ } else {
+ originalDataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ if (updatedDataBuilder_ == null) {
+ updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ } else {
+ updatedDataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000008);
+ if (createdDataBuilder_ == null) {
+ createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ } else {
+ createdDataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000010);
+ if (removedPathsBuilder_ == null) {
+ removedPaths_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000020);
+ } else {
+ removedPathsBuilder_.clear();
+ }
return this;
}
org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged result = new org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(
- instanceIdentifierPathArguments_);
- bitField0_ = (bitField0_ & ~0x00000001);
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ if (originalSubTreeBuilder_ == null) {
+ result.originalSubTree_ = originalSubTree_;
+ } else {
+ result.originalSubTree_ = originalSubTreeBuilder_.build();
}
- result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
- to_bitField0_ |= 0x00000001;
+ to_bitField0_ |= 0x00000002;
+ }
+ if (updatedSubTreeBuilder_ == null) {
+ result.updatedSubTree_ = updatedSubTree_;
+ } else {
+ result.updatedSubTree_ = updatedSubTreeBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ if (originalDataBuilder_ == null) {
+ result.originalData_ = originalData_;
+ } else {
+ result.originalData_ = originalDataBuilder_.build();
}
- if (normalizedNodeXmlBuilder_ == null) {
- result.normalizedNodeXml_ = normalizedNodeXml_;
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ if (updatedDataBuilder_ == null) {
+ result.updatedData_ = updatedData_;
+ } else {
+ result.updatedData_ = updatedDataBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ if (createdDataBuilder_ == null) {
+ result.createdData_ = createdData_;
} else {
- result.normalizedNodeXml_ = normalizedNodeXmlBuilder_.build();
+ result.createdData_ = createdDataBuilder_.build();
+ }
+ if (removedPathsBuilder_ == null) {
+ if (((bitField0_ & 0x00000020) == 0x00000020)) {
+ removedPaths_ = java.util.Collections.unmodifiableList(removedPaths_);
+ bitField0_ = (bitField0_ & ~0x00000020);
+ }
+ result.removedPaths_ = removedPaths_;
+ } else {
+ result.removedPaths_ = removedPathsBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged other) {
if (other == org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.getDefaultInstance()) return this;
- if (!other.instanceIdentifierPathArguments_.isEmpty()) {
- if (instanceIdentifierPathArguments_.isEmpty()) {
- instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_;
- bitField0_ = (bitField0_ & ~0x00000001);
- } else {
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.addAll(other.instanceIdentifierPathArguments_);
- }
- onChanged();
+ if (other.hasOriginalSubTree()) {
+ mergeOriginalSubTree(other.getOriginalSubTree());
+ }
+ if (other.hasUpdatedSubTree()) {
+ mergeUpdatedSubTree(other.getUpdatedSubTree());
+ }
+ if (other.hasOriginalData()) {
+ mergeOriginalData(other.getOriginalData());
}
- if (other.hasNormalizedNodeXml()) {
- mergeNormalizedNodeXml(other.getNormalizedNodeXml());
+ if (other.hasUpdatedData()) {
+ mergeUpdatedData(other.getUpdatedData());
+ }
+ if (other.hasCreatedData()) {
+ mergeCreatedData(other.getCreatedData());
+ }
+ if (removedPathsBuilder_ == null) {
+ if (!other.removedPaths_.isEmpty()) {
+ if (removedPaths_.isEmpty()) {
+ removedPaths_ = other.removedPaths_;
+ bitField0_ = (bitField0_ & ~0x00000020);
+ } else {
+ ensureRemovedPathsIsMutable();
+ removedPaths_.addAll(other.removedPaths_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.removedPaths_.isEmpty()) {
+ if (removedPathsBuilder_.isEmpty()) {
+ removedPathsBuilder_.dispose();
+ removedPathsBuilder_ = null;
+ removedPaths_ = other.removedPaths_;
+ bitField0_ = (bitField0_ & ~0x00000020);
+ removedPathsBuilder_ =
+ com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getRemovedPathsFieldBuilder() : null;
+ } else {
+ removedPathsBuilder_.addAllMessages(other.removedPaths_);
+ }
+ }
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
- if (!hasNormalizedNodeXml()) {
-
- return false;
+ if (hasOriginalSubTree()) {
+ if (!getOriginalSubTree().isInitialized()) {
+
+ return false;
+ }
}
- if (!getNormalizedNodeXml().isInitialized()) {
-
- return false;
+ if (hasUpdatedSubTree()) {
+ if (!getUpdatedSubTree().isInitialized()) {
+
+ return false;
+ }
+ }
+ if (hasOriginalData()) {
+ if (!getOriginalData().isInitialized()) {
+
+ return false;
+ }
+ }
+ if (hasUpdatedData()) {
+ if (!getUpdatedData().isInitialized()) {
+
+ return false;
+ }
+ }
+ if (hasCreatedData()) {
+ if (!getCreatedData().isInitialized()) {
+
+ return false;
+ }
+ }
+ for (int i = 0; i < getRemovedPathsCount(); i++) {
+ if (!getRemovedPaths(i).isInitialized()) {
+
+ return false;
+ }
}
return true;
}
}
private int bitField0_;
- // repeated string instanceIdentifierPathArguments = 1;
- private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- private void ensureInstanceIdentifierPathArgumentsIsMutable() {
- if (!((bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList(instanceIdentifierPathArguments_);
- bitField0_ |= 0x00000001;
- }
- }
+ // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> originalSubTreeBuilder_;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList() {
- return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+ public boolean hasOriginalSubTree() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public int getInstanceIdentifierPathArgumentsCount() {
- return instanceIdentifierPathArguments_.size();
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree() {
+ if (originalSubTreeBuilder_ == null) {
+ return originalSubTree_;
+ } else {
+ return originalSubTreeBuilder_.getMessage();
+ }
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public java.lang.String getInstanceIdentifierPathArguments(int index) {
- return instanceIdentifierPathArguments_.get(index);
+ public Builder setOriginalSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (originalSubTreeBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ originalSubTree_ = value;
+ onChanged();
+ } else {
+ originalSubTreeBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index) {
- return instanceIdentifierPathArguments_.getByteString(index);
+ public Builder setOriginalSubTree(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (originalSubTreeBuilder_ == null) {
+ originalSubTree_ = builderForValue.build();
+ onChanged();
+ } else {
+ originalSubTreeBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public Builder setInstanceIdentifierPathArguments(
- int index, java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.set(index, value);
- onChanged();
+ public Builder mergeOriginalSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (originalSubTreeBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ originalSubTree_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+ originalSubTree_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(originalSubTree_).mergeFrom(value).buildPartial();
+ } else {
+ originalSubTree_ = value;
+ }
+ onChanged();
+ } else {
+ originalSubTreeBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public Builder addInstanceIdentifierPathArguments(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.add(value);
- onChanged();
+ public Builder clearOriginalSubTree() {
+ if (originalSubTreeBuilder_ == null) {
+ originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ onChanged();
+ } else {
+ originalSubTreeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public Builder addAllInstanceIdentifierPathArguments(
- java.lang.Iterable<java.lang.String> values) {
- ensureInstanceIdentifierPathArgumentsIsMutable();
- super.addAll(values, instanceIdentifierPathArguments_);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getOriginalSubTreeBuilder() {
+ bitField0_ |= 0x00000001;
onChanged();
- return this;
+ return getOriginalSubTreeFieldBuilder().getBuilder();
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public Builder clearInstanceIdentifierPathArguments() {
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- bitField0_ = (bitField0_ & ~0x00000001);
- onChanged();
- return this;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder() {
+ if (originalSubTreeBuilder_ != null) {
+ return originalSubTreeBuilder_.getMessageOrBuilder();
+ } else {
+ return originalSubTree_;
+ }
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
- public Builder addInstanceIdentifierPathArgumentsBytes(
- com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.add(value);
- onChanged();
- return this;
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getOriginalSubTreeFieldBuilder() {
+ if (originalSubTreeBuilder_ == null) {
+ originalSubTreeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+ originalSubTree_,
+ getParentForChildren(),
+ isClean());
+ originalSubTree_ = null;
+ }
+ return originalSubTreeBuilder_;
}
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;
- private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder> normalizedNodeXmlBuilder_;
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> updatedSubTreeBuilder_;
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public boolean hasNormalizedNodeXml() {
+ public boolean hasUpdatedSubTree() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml() {
- if (normalizedNodeXmlBuilder_ == null) {
- return normalizedNodeXml_;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree() {
+ if (updatedSubTreeBuilder_ == null) {
+ return updatedSubTree_;
} else {
- return normalizedNodeXmlBuilder_.getMessage();
+ return updatedSubTreeBuilder_.getMessage();
}
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public Builder setNormalizedNodeXml(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
- if (normalizedNodeXmlBuilder_ == null) {
+ public Builder setUpdatedSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (updatedSubTreeBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
- normalizedNodeXml_ = value;
+ updatedSubTree_ = value;
onChanged();
} else {
- normalizedNodeXmlBuilder_.setMessage(value);
+ updatedSubTreeBuilder_.setMessage(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public Builder setNormalizedNodeXml(
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
- if (normalizedNodeXmlBuilder_ == null) {
- normalizedNodeXml_ = builderForValue.build();
+ public Builder setUpdatedSubTree(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (updatedSubTreeBuilder_ == null) {
+ updatedSubTree_ = builderForValue.build();
onChanged();
} else {
- normalizedNodeXmlBuilder_.setMessage(builderForValue.build());
+ updatedSubTreeBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000002;
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public Builder mergeNormalizedNodeXml(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
- if (normalizedNodeXmlBuilder_ == null) {
+ public Builder mergeUpdatedSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (updatedSubTreeBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
- normalizedNodeXml_ != org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance()) {
- normalizedNodeXml_ =
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder(normalizedNodeXml_).mergeFrom(value).buildPartial();
+ updatedSubTree_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+ updatedSubTree_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(updatedSubTree_).mergeFrom(value).buildPartial();
} else {
- normalizedNodeXml_ = value;
+ updatedSubTree_ = value;
}
onChanged();
} else {
- normalizedNodeXmlBuilder_.mergeFrom(value);
+ updatedSubTreeBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000002;
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public Builder clearNormalizedNodeXml() {
- if (normalizedNodeXmlBuilder_ == null) {
- normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ public Builder clearUpdatedSubTree() {
+ if (updatedSubTreeBuilder_ == null) {
+ updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
onChanged();
} else {
- normalizedNodeXmlBuilder_.clear();
+ updatedSubTreeBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeXmlBuilder() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getUpdatedSubTreeBuilder() {
bitField0_ |= 0x00000002;
onChanged();
- return getNormalizedNodeXmlFieldBuilder().getBuilder();
+ return getUpdatedSubTreeFieldBuilder().getBuilder();
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder() {
- if (normalizedNodeXmlBuilder_ != null) {
- return normalizedNodeXmlBuilder_.getMessageOrBuilder();
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder() {
+ if (updatedSubTreeBuilder_ != null) {
+ return updatedSubTreeBuilder_.getMessageOrBuilder();
} else {
- return normalizedNodeXml_;
+ return updatedSubTree_;
}
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>
- getNormalizedNodeXmlFieldBuilder() {
- if (normalizedNodeXmlBuilder_ == null) {
- normalizedNodeXmlBuilder_ = new com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>(
- normalizedNodeXml_,
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getUpdatedSubTreeFieldBuilder() {
+ if (updatedSubTreeBuilder_ == null) {
+ updatedSubTreeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+ updatedSubTree_,
+ getParentForChildren(),
+ isClean());
+ updatedSubTree_ = null;
+ }
+ return updatedSubTreeBuilder_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> originalDataBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public boolean hasOriginalData() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData() {
+ if (originalDataBuilder_ == null) {
+ return originalData_;
+ } else {
+ return originalDataBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public Builder setOriginalData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+ if (originalDataBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ originalData_ = value;
+ onChanged();
+ } else {
+ originalDataBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public Builder setOriginalData(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) {
+ if (originalDataBuilder_ == null) {
+ originalData_ = builderForValue.build();
+ onChanged();
+ } else {
+ originalDataBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public Builder mergeOriginalData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+ if (originalDataBuilder_ == null) {
+ if (((bitField0_ & 0x00000004) == 0x00000004) &&
+ originalData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) {
+ originalData_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(originalData_).mergeFrom(value).buildPartial();
+ } else {
+ originalData_ = value;
+ }
+ onChanged();
+ } else {
+ originalDataBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public Builder clearOriginalData() {
+ if (originalDataBuilder_ == null) {
+ originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ onChanged();
+ } else {
+ originalDataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getOriginalDataBuilder() {
+ bitField0_ |= 0x00000004;
+ onChanged();
+ return getOriginalDataFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder() {
+ if (originalDataBuilder_ != null) {
+ return originalDataBuilder_.getMessageOrBuilder();
+ } else {
+ return originalData_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
+ getOriginalDataFieldBuilder() {
+ if (originalDataBuilder_ == null) {
+ originalDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>(
+ originalData_,
+ getParentForChildren(),
+ isClean());
+ originalData_ = null;
+ }
+ return originalDataBuilder_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> updatedDataBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public boolean hasUpdatedData() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData() {
+ if (updatedDataBuilder_ == null) {
+ return updatedData_;
+ } else {
+ return updatedDataBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public Builder setUpdatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+ if (updatedDataBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ updatedData_ = value;
+ onChanged();
+ } else {
+ updatedDataBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000008;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public Builder setUpdatedData(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) {
+ if (updatedDataBuilder_ == null) {
+ updatedData_ = builderForValue.build();
+ onChanged();
+ } else {
+ updatedDataBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000008;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public Builder mergeUpdatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+ if (updatedDataBuilder_ == null) {
+ if (((bitField0_ & 0x00000008) == 0x00000008) &&
+ updatedData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) {
+ updatedData_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(updatedData_).mergeFrom(value).buildPartial();
+ } else {
+ updatedData_ = value;
+ }
+ onChanged();
+ } else {
+ updatedDataBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000008;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public Builder clearUpdatedData() {
+ if (updatedDataBuilder_ == null) {
+ updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ onChanged();
+ } else {
+ updatedDataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000008);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getUpdatedDataBuilder() {
+ bitField0_ |= 0x00000008;
+ onChanged();
+ return getUpdatedDataFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder() {
+ if (updatedDataBuilder_ != null) {
+ return updatedDataBuilder_.getMessageOrBuilder();
+ } else {
+ return updatedData_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
+ getUpdatedDataFieldBuilder() {
+ if (updatedDataBuilder_ == null) {
+ updatedDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>(
+ updatedData_,
+ getParentForChildren(),
+ isClean());
+ updatedData_ = null;
+ }
+ return updatedDataBuilder_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> createdDataBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public boolean hasCreatedData() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData() {
+ if (createdDataBuilder_ == null) {
+ return createdData_;
+ } else {
+ return createdDataBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public Builder setCreatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+ if (createdDataBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ createdData_ = value;
+ onChanged();
+ } else {
+ createdDataBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000010;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public Builder setCreatedData(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) {
+ if (createdDataBuilder_ == null) {
+ createdData_ = builderForValue.build();
+ onChanged();
+ } else {
+ createdDataBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000010;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public Builder mergeCreatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+ if (createdDataBuilder_ == null) {
+ if (((bitField0_ & 0x00000010) == 0x00000010) &&
+ createdData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) {
+ createdData_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(createdData_).mergeFrom(value).buildPartial();
+ } else {
+ createdData_ = value;
+ }
+ onChanged();
+ } else {
+ createdDataBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000010;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public Builder clearCreatedData() {
+ if (createdDataBuilder_ == null) {
+ createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+ onChanged();
+ } else {
+ createdDataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000010);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getCreatedDataBuilder() {
+ bitField0_ |= 0x00000010;
+ onChanged();
+ return getCreatedDataFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder() {
+ if (createdDataBuilder_ != null) {
+ return createdDataBuilder_.getMessageOrBuilder();
+ } else {
+ return createdData_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
+ getCreatedDataFieldBuilder() {
+ if (createdDataBuilder_ == null) {
+ createdDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>(
+ createdData_,
+ getParentForChildren(),
+ isClean());
+ createdData_ = null;
+ }
+ return createdDataBuilder_;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> removedPaths_ =
+ java.util.Collections.emptyList();
+ private void ensureRemovedPathsIsMutable() {
+ if (!((bitField0_ & 0x00000020) == 0x00000020)) {
+ removedPaths_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier>(removedPaths_);
+ bitField0_ |= 0x00000020;
+ }
+ }
+
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> removedPathsBuilder_;
+
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> getRemovedPathsList() {
+ if (removedPathsBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(removedPaths_);
+ } else {
+ return removedPathsBuilder_.getMessageList();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public int getRemovedPathsCount() {
+ if (removedPathsBuilder_ == null) {
+ return removedPaths_.size();
+ } else {
+ return removedPathsBuilder_.getCount();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index) {
+ if (removedPathsBuilder_ == null) {
+ return removedPaths_.get(index);
+ } else {
+ return removedPathsBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder setRemovedPaths(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (removedPathsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureRemovedPathsIsMutable();
+ removedPaths_.set(index, value);
+ onChanged();
+ } else {
+ removedPathsBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder setRemovedPaths(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (removedPathsBuilder_ == null) {
+ ensureRemovedPathsIsMutable();
+ removedPaths_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ removedPathsBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder addRemovedPaths(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (removedPathsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureRemovedPathsIsMutable();
+ removedPaths_.add(value);
+ onChanged();
+ } else {
+ removedPathsBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder addRemovedPaths(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (removedPathsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureRemovedPathsIsMutable();
+ removedPaths_.add(index, value);
+ onChanged();
+ } else {
+ removedPathsBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder addRemovedPaths(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (removedPathsBuilder_ == null) {
+ ensureRemovedPathsIsMutable();
+ removedPaths_.add(builderForValue.build());
+ onChanged();
+ } else {
+ removedPathsBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder addRemovedPaths(
+ int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (removedPathsBuilder_ == null) {
+ ensureRemovedPathsIsMutable();
+ removedPaths_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ removedPathsBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder addAllRemovedPaths(
+ java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> values) {
+ if (removedPathsBuilder_ == null) {
+ ensureRemovedPathsIsMutable();
+ super.addAll(values, removedPaths_);
+ onChanged();
+ } else {
+ removedPathsBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder clearRemovedPaths() {
+ if (removedPathsBuilder_ == null) {
+ removedPaths_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000020);
+ onChanged();
+ } else {
+ removedPathsBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public Builder removeRemovedPaths(int index) {
+ if (removedPathsBuilder_ == null) {
+ ensureRemovedPathsIsMutable();
+ removedPaths_.remove(index);
+ onChanged();
+ } else {
+ removedPathsBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getRemovedPathsBuilder(
+ int index) {
+ return getRemovedPathsFieldBuilder().getBuilder(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder(
+ int index) {
+ if (removedPathsBuilder_ == null) {
+ return removedPaths_.get(index); } else {
+ return removedPathsBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getRemovedPathsOrBuilderList() {
+ if (removedPathsBuilder_ != null) {
+ return removedPathsBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(removedPaths_);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder addRemovedPathsBuilder() {
+ return getRemovedPathsFieldBuilder().addBuilder(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder addRemovedPathsBuilder(
+ int index) {
+ return getRemovedPathsFieldBuilder().addBuilder(
+ index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder>
+ getRemovedPathsBuilderList() {
+ return getRemovedPathsFieldBuilder().getBuilderList();
+ }
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getRemovedPathsFieldBuilder() {
+ if (removedPathsBuilder_ == null) {
+ removedPathsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ removedPaths_,
+ ((bitField0_ & 0x00000020) == 0x00000020),
getParentForChildren(),
isClean());
- normalizedNodeXml_ = null;
+ removedPaths_ = null;
}
- return normalizedNodeXmlBuilder_;
+ return removedPathsBuilder_;
}
// @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DataChanged)
static {
java.lang.String[] descriptorData = {
"\n\030DataChangeListener.proto\022!org.opendayl" +
- "ight.controller.mdsal\032\032SimpleNormalizedN" +
- "ode.proto\"\207\001\n\013DataChanged\022\'\n\037instanceIde" +
- "ntifierPathArguments\030\001 \003(\t\022O\n\021normalized" +
- "NodeXml\030\002 \002(\01324.org.opendaylight.control" +
- "ler.mdsal.NormalizedNodeXml\"\022\n\020DataChang" +
- "edReplyBd\nForg.opendaylight.controller.p" +
- "rotobuff.messages.datachange.notificatio" +
- "nB\032DataChangeListenerMessages"
+ "ight.controller.mdsal\032\014Common.proto\"\241\003\n\013" +
+ "DataChanged\022@\n\017originalSubTree\030\001 \001(\0132\'.o" +
+ "rg.opendaylight.controller.mdsal.Node\022?\n" +
+ "\016updatedSubTree\030\002 \001(\0132\'.org.opendaylight" +
+ ".controller.mdsal.Node\022@\n\014originalData\030\003" +
+ " \001(\0132*.org.opendaylight.controller.mdsal" +
+ ".NodeMap\022?\n\013updatedData\030\004 \001(\0132*.org.open" +
+ "daylight.controller.mdsal.NodeMap\022?\n\013cre" +
+ "atedData\030\005 \001(\0132*.org.opendaylight.contro",
+ "ller.mdsal.NodeMap\022K\n\014removedPaths\030\006 \003(\013" +
+ "25.org.opendaylight.controller.mdsal.Ins" +
+ "tanceIdentifier\"\022\n\020DataChangedReplyBd\nFo" +
+ "rg.opendaylight.controller.protobuff.mes" +
+ "sages.datachange.notificationB\032DataChang" +
+ "eListenerMessages"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
internal_static_org_opendaylight_controller_mdsal_DataChanged_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_opendaylight_controller_mdsal_DataChanged_descriptor,
- new java.lang.String[] { "InstanceIdentifierPathArguments", "NormalizedNodeXml", });
+ new java.lang.String[] { "OriginalSubTree", "UpdatedSubTree", "OriginalData", "UpdatedData", "CreatedData", "RemovedPaths", });
internal_static_org_opendaylight_controller_mdsal_DataChangedReply_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_org_opendaylight_controller_mdsal_DataChangedReply_fieldAccessorTable = new
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.getDescriptor(),
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
}, assigner);
}
--- /dev/null
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: Persistent.proto
+
+package org.opendaylight.controller.protobuff.messages.persistent;
+
+public final class PersistentMessages {
+ private PersistentMessages() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ }
+ public interface ModificationOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string type = 1;
+ /**
+ * <code>required string type = 1;</code>
+ */
+ boolean hasType();
+ /**
+ * <code>required string type = 1;</code>
+ */
+ java.lang.String getType();
+ /**
+ * <code>required string type = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getTypeBytes();
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ boolean hasPath();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder();
+
+ // optional .org.opendaylight.controller.mdsal.Node data = 3;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ boolean hasData();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.Modification}
+ */
+ public static final class Modification extends
+ com.google.protobuf.GeneratedMessage
+ implements ModificationOrBuilder {
+ // Use Modification.newBuilder() to construct.
+ private Modification(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private Modification(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final Modification defaultInstance;
+ public static Modification getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Modification getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private Modification(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ type_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ subBuilder = path_.toBuilder();
+ }
+ path_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(path_);
+ path_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000002;
+ break;
+ }
+ case 26: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ subBuilder = data_.toBuilder();
+ }
+ data_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(data_);
+ data_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000004;
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.class, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<Modification> PARSER =
+ new com.google.protobuf.AbstractParser<Modification>() {
+ public Modification parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new Modification(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<Modification> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string type = 1;
+ public static final int TYPE_FIELD_NUMBER = 1;
+ private java.lang.Object type_;
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ type_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;
+ public static final int PATH_FIELD_NUMBER = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier path_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public boolean hasPath() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath() {
+ return path_;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder() {
+ return path_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.Node data = 3;
+ public static final int DATA_FIELD_NUMBER = 3;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node data_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public boolean hasData() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData() {
+ return data_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder() {
+ return data_;
+ }
+
+ private void initFields() {
+ type_ = "";
+ path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasType()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!getPath().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (hasData()) {
+ if (!getData().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getTypeBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeMessage(2, path_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeMessage(3, data_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getTypeBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(2, path_);
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(3, data_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.Modification}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.class, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getPathFieldBuilder();
+ getDataFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ type_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ if (pathBuilder_ == null) {
+ path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ pathBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000002);
+ if (dataBuilder_ == null) {
+ data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ } else {
+ dataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification build() {
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification buildPartial() {
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification result = new org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.type_ = type_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ if (pathBuilder_ == null) {
+ result.path_ = path_;
+ } else {
+ result.path_ = pathBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ if (dataBuilder_ == null) {
+ result.data_ = data_;
+ } else {
+ result.data_ = dataBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification other) {
+ if (other == org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.getDefaultInstance()) return this;
+ if (other.hasType()) {
+ bitField0_ |= 0x00000001;
+ type_ = other.type_;
+ onChanged();
+ }
+ if (other.hasPath()) {
+ mergePath(other.getPath());
+ }
+ if (other.hasData()) {
+ mergeData(other.getData());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasType()) {
+
+ return false;
+ }
+ if (!hasPath()) {
+
+ return false;
+ }
+ if (!getPath().isInitialized()) {
+
+ return false;
+ }
+ if (hasData()) {
+ if (!getData().isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string type = 1;
+ private java.lang.Object type_ = "";
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public java.lang.String getType() {
+ java.lang.Object ref = type_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ type_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ java.lang.Object ref = type_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public Builder setType(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public Builder clearType() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ type_ = getDefaultInstance().getType();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string type = 1;</code>
+ */
+ public Builder setTypeBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> pathBuilder_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public boolean hasPath() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath() {
+ if (pathBuilder_ == null) {
+ return path_;
+ } else {
+ return pathBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public Builder setPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (pathBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ path_ = value;
+ onChanged();
+ } else {
+ pathBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public Builder setPath(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (pathBuilder_ == null) {
+ path_ = builderForValue.build();
+ onChanged();
+ } else {
+ pathBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public Builder mergePath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (pathBuilder_ == null) {
+ if (((bitField0_ & 0x00000002) == 0x00000002) &&
+ path_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ path_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(path_).mergeFrom(value).buildPartial();
+ } else {
+ path_ = value;
+ }
+ onChanged();
+ } else {
+ pathBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public Builder clearPath() {
+ if (pathBuilder_ == null) {
+ path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ onChanged();
+ } else {
+ pathBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getPathBuilder() {
+ bitField0_ |= 0x00000002;
+ onChanged();
+ return getPathFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder() {
+ if (pathBuilder_ != null) {
+ return pathBuilder_.getMessageOrBuilder();
+ } else {
+ return path_;
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getPathFieldBuilder() {
+ if (pathBuilder_ == null) {
+ pathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ path_,
+ getParentForChildren(),
+ isClean());
+ path_ = null;
+ }
+ return pathBuilder_;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.Node data = 3;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> dataBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public boolean hasData() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData() {
+ if (dataBuilder_ == null) {
+ return data_;
+ } else {
+ return dataBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public Builder setData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (dataBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ data_ = value;
+ onChanged();
+ } else {
+ dataBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public Builder setData(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (dataBuilder_ == null) {
+ data_ = builderForValue.build();
+ onChanged();
+ } else {
+ dataBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public Builder mergeData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (dataBuilder_ == null) {
+ if (((bitField0_ & 0x00000004) == 0x00000004) &&
+ data_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+ data_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(data_).mergeFrom(value).buildPartial();
+ } else {
+ data_ = value;
+ }
+ onChanged();
+ } else {
+ dataBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000004;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public Builder clearData() {
+ if (dataBuilder_ == null) {
+ data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ onChanged();
+ } else {
+ dataBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getDataBuilder() {
+ bitField0_ |= 0x00000004;
+ onChanged();
+ return getDataFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder() {
+ if (dataBuilder_ != null) {
+ return dataBuilder_.getMessageOrBuilder();
+ } else {
+ return data_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getDataFieldBuilder() {
+ if (dataBuilder_ == null) {
+ dataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+ data_,
+ getParentForChildren(),
+ isClean());
+ data_ = null;
+ }
+ return dataBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Modification)
+ }
+
+ static {
+ defaultInstance = new Modification(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Modification)
+ }
+
+ public interface CompositeModificationOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // repeated .org.opendaylight.controller.mdsal.Modification modification = 1;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification>
+ getModificationList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification(int index);
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ int getModificationCount();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
+ getModificationOrBuilderList();
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder(
+ int index);
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CompositeModification}
+ */
+ public static final class CompositeModification extends
+ com.google.protobuf.GeneratedMessage
+ implements CompositeModificationOrBuilder {
+ // Use CompositeModification.newBuilder() to construct.
+ private CompositeModification(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private CompositeModification(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final CompositeModification defaultInstance;
+ public static CompositeModification getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public CompositeModification getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private CompositeModification(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ modification_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification>();
+ mutable_bitField0_ |= 0x00000001;
+ }
+ modification_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.PARSER, extensionRegistry));
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ modification_ = java.util.Collections.unmodifiableList(modification_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<CompositeModification> PARSER =
+ new com.google.protobuf.AbstractParser<CompositeModification>() {
+ public CompositeModification parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new CompositeModification(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<CompositeModification> getParserForType() {
+ return PARSER;
+ }
+
+ // repeated .org.opendaylight.controller.mdsal.Modification modification = 1;
+ public static final int MODIFICATION_FIELD_NUMBER = 1;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> modification_;
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> getModificationList() {
+ return modification_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
+ getModificationOrBuilderList() {
+ return modification_;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public int getModificationCount() {
+ return modification_.size();
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification(int index) {
+ return modification_.get(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder(
+ int index) {
+ return modification_.get(index);
+ }
+
+ private void initFields() {
+ modification_ = java.util.Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ for (int i = 0; i < getModificationCount(); i++) {
+ if (!getModification(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ for (int i = 0; i < modification_.size(); i++) {
+ output.writeMessage(1, modification_.get(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ for (int i = 0; i < modification_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, modification_.get(i));
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CompositeModification}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModificationOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getModificationFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ if (modificationBuilder_ == null) {
+ modification_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ modificationBuilder_.clear();
+ }
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification build() {
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification buildPartial() {
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification result = new org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification(this);
+ int from_bitField0_ = bitField0_;
+ if (modificationBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ modification_ = java.util.Collections.unmodifiableList(modification_);
+ bitField0_ = (bitField0_ & ~0x00000001);
+ }
+ result.modification_ = modification_;
+ } else {
+ result.modification_ = modificationBuilder_.build();
+ }
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification other) {
+ if (other == org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.getDefaultInstance()) return this;
+ if (modificationBuilder_ == null) {
+ if (!other.modification_.isEmpty()) {
+ if (modification_.isEmpty()) {
+ modification_ = other.modification_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ } else {
+ ensureModificationIsMutable();
+ modification_.addAll(other.modification_);
+ }
+ onChanged();
+ }
+ } else {
+ if (!other.modification_.isEmpty()) {
+ if (modificationBuilder_.isEmpty()) {
+ modificationBuilder_.dispose();
+ modificationBuilder_ = null;
+ modification_ = other.modification_;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ modificationBuilder_ =
+ com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+ getModificationFieldBuilder() : null;
+ } else {
+ modificationBuilder_.addAllMessages(other.modification_);
+ }
+ }
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ for (int i = 0; i < getModificationCount(); i++) {
+ if (!getModification(i).isInitialized()) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // repeated .org.opendaylight.controller.mdsal.Modification modification = 1;
+ private java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> modification_ =
+ java.util.Collections.emptyList();
+ private void ensureModificationIsMutable() {
+ if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+ modification_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification>(modification_);
+ bitField0_ |= 0x00000001;
+ }
+ }
+
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder> modificationBuilder_;
+
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> getModificationList() {
+ if (modificationBuilder_ == null) {
+ return java.util.Collections.unmodifiableList(modification_);
+ } else {
+ return modificationBuilder_.getMessageList();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public int getModificationCount() {
+ if (modificationBuilder_ == null) {
+ return modification_.size();
+ } else {
+ return modificationBuilder_.getCount();
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification(int index) {
+ if (modificationBuilder_ == null) {
+ return modification_.get(index);
+ } else {
+ return modificationBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder setModification(
+ int index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) {
+ if (modificationBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureModificationIsMutable();
+ modification_.set(index, value);
+ onChanged();
+ } else {
+ modificationBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder setModification(
+ int index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) {
+ if (modificationBuilder_ == null) {
+ ensureModificationIsMutable();
+ modification_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ modificationBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder addModification(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) {
+ if (modificationBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureModificationIsMutable();
+ modification_.add(value);
+ onChanged();
+ } else {
+ modificationBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder addModification(
+ int index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) {
+ if (modificationBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureModificationIsMutable();
+ modification_.add(index, value);
+ onChanged();
+ } else {
+ modificationBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder addModification(
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) {
+ if (modificationBuilder_ == null) {
+ ensureModificationIsMutable();
+ modification_.add(builderForValue.build());
+ onChanged();
+ } else {
+ modificationBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder addModification(
+ int index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) {
+ if (modificationBuilder_ == null) {
+ ensureModificationIsMutable();
+ modification_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ modificationBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder addAllModification(
+ java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> values) {
+ if (modificationBuilder_ == null) {
+ ensureModificationIsMutable();
+ super.addAll(values, modification_);
+ onChanged();
+ } else {
+ modificationBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder clearModification() {
+ if (modificationBuilder_ == null) {
+ modification_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ onChanged();
+ } else {
+ modificationBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public Builder removeModification(int index) {
+ if (modificationBuilder_ == null) {
+ ensureModificationIsMutable();
+ modification_.remove(index);
+ onChanged();
+ } else {
+ modificationBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder getModificationBuilder(
+ int index) {
+ return getModificationFieldBuilder().getBuilder(index);
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder(
+ int index) {
+ if (modificationBuilder_ == null) {
+ return modification_.get(index); } else {
+ return modificationBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
+ getModificationOrBuilderList() {
+ if (modificationBuilder_ != null) {
+ return modificationBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(modification_);
+ }
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder addModificationBuilder() {
+ return getModificationFieldBuilder().addBuilder(
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder addModificationBuilder(
+ int index) {
+ return getModificationFieldBuilder().addBuilder(
+ index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.getDefaultInstance());
+ }
+ /**
+ * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+ */
+ public java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder>
+ getModificationBuilderList() {
+ return getModificationFieldBuilder().getBuilderList();
+ }
+ private com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
+ getModificationFieldBuilder() {
+ if (modificationBuilder_ == null) {
+ modificationBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>(
+ modification_,
+ ((bitField0_ & 0x00000001) == 0x00000001),
+ getParentForChildren(),
+ isClean());
+ modification_ = null;
+ }
+ return modificationBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CompositeModification)
+ }
+
+ static {
+ defaultInstance = new CompositeModification(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CompositeModification)
+ }
+
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_Modification_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\020Persistent.proto\022!org.opendaylight.con" +
+ "troller.mdsal\032\014Common.proto\032\033AppendEntri" +
+ "esMessages.proto\"\230\001\n\014Modification\022\014\n\004typ" +
+ "e\030\001 \002(\t\022C\n\004path\030\002 \002(\01325.org.opendaylight" +
+ ".controller.mdsal.InstanceIdentifier\0225\n\004" +
+ "data\030\003 \001(\0132\'.org.opendaylight.controller" +
+ ".mdsal.Node\"^\n\025CompositeModification\022E\n\014" +
+ "modification\030\001 \003(\0132/.org.opendaylight.co" +
+ "ntroller.mdsal.ModificationBO\n9org.opend" +
+ "aylight.controller.protobuff.messages.pe",
+ "rsistentB\022PersistentMessages"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ internal_static_org_opendaylight_controller_mdsal_Modification_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_Modification_descriptor,
+ new java.lang.String[] { "Type", "Path", "Data", });
+ internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor,
+ new java.lang.String[] { "Modification", });
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
+ org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
- public interface CloseOrBuilder
+ public interface CloseDataChangeListenerRegistrationOrBuilder
extends com.google.protobuf.MessageOrBuilder {
}
/**
- * Protobuf type {@code org.opendaylight.controller.mdsal.Close}
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistration}
+ *
+ * <pre>
+ ** used when a listener needs to be unregistered
+ * </pre>
*/
- public static final class Close extends
+ public static final class CloseDataChangeListenerRegistration extends
com.google.protobuf.GeneratedMessage
- implements CloseOrBuilder {
- // Use Close.newBuilder() to construct.
- private Close(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ implements CloseDataChangeListenerRegistrationOrBuilder {
+ // Use CloseDataChangeListenerRegistration.newBuilder() to construct.
+ private CloseDataChangeListenerRegistration(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
- private Close(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+ private CloseDataChangeListenerRegistration(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
- private static final Close defaultInstance;
- public static Close getDefaultInstance() {
+ private static final CloseDataChangeListenerRegistration defaultInstance;
+ public static CloseDataChangeListenerRegistration getDefaultInstance() {
return defaultInstance;
}
- public Close getDefaultInstanceForType() {
+ public CloseDataChangeListenerRegistration getDefaultInstanceForType() {
return defaultInstance;
}
getUnknownFields() {
return this.unknownFields;
}
- private Close(
+ private CloseDataChangeListenerRegistration(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_fieldAccessorTable
.ensureFieldAccessorsInitialized(
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.Builder.class);
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.Builder.class);
}
- public static com.google.protobuf.Parser<Close> PARSER =
- new com.google.protobuf.AbstractParser<Close>() {
- public Close parsePartialFrom(
+ public static com.google.protobuf.Parser<CloseDataChangeListenerRegistration> PARSER =
+ new com.google.protobuf.AbstractParser<CloseDataChangeListenerRegistration>() {
+ public CloseDataChangeListenerRegistration parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- return new Close(input, extensionRegistry);
+ return new CloseDataChangeListenerRegistration(input, extensionRegistry);
}
};
@java.lang.Override
- public com.google.protobuf.Parser<Close> getParserForType() {
+ public com.google.protobuf.Parser<CloseDataChangeListenerRegistration> getParserForType() {
return PARSER;
}
return super.writeReplace();
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(byte[] data)
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(java.io.InputStream input)
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseDelimitedFrom(java.io.InputStream input)
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseDelimitedFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close prototype) {
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
return builder;
}
/**
- * Protobuf type {@code org.opendaylight.controller.mdsal.Close}
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistration}
+ *
+ * <pre>
+ ** used when a listener needs to be unregistered
+ * </pre>
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
- implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseOrBuilder {
+ implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_fieldAccessorTable
.ensureFieldAccessorsInitialized(
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.Builder.class);
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.Builder.class);
}
- // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.newBuilder()
+ // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close getDefaultInstanceForType() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.getDefaultInstance();
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close build() {
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close result = buildPartial();
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration build() {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
- public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close buildPartial() {
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close(this);
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration buildPartial() {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration(this);
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
- if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close) {
- return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close)other);
+ if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration)other);
} else {
super.mergeFrom(other);
return this;
}
}
- public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close other) {
- if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.getDefaultInstance()) return this;
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration other) {
+ if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.getDefaultInstance()) return this;
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parsedMessage = null;
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close) e.getUnfinishedMessage();
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
return this;
}
- // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Close)
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistration)
}
static {
- defaultInstance = new Close(true);
+ defaultInstance = new CloseDataChangeListenerRegistration(true);
defaultInstance.initFields();
}
- // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Close)
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistration)
}
- public interface CloseReplyOrBuilder
+ public interface CloseDataChangeListenerRegistrationReplyOrBuilder
extends com.google.protobuf.MessageOrBuilder {
}
/**
- * Protobuf type {@code org.opendaylight.controller.mdsal.CloseReply}
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistrationReply}
+ *
+ * <pre>
+ ** reply to the CloseDataChangeListenerRegistration request
+ * </pre>
*/
- public static final class CloseReply extends
+ public static final class CloseDataChangeListenerRegistrationReply extends
com.google.protobuf.GeneratedMessage
- implements CloseReplyOrBuilder {
- // Use CloseReply.newBuilder() to construct.
- private CloseReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ implements CloseDataChangeListenerRegistrationReplyOrBuilder {
+ // Use CloseDataChangeListenerRegistrationReply.newBuilder() to construct.
+ private CloseDataChangeListenerRegistrationReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
- private CloseReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+ private CloseDataChangeListenerRegistrationReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
- private static final CloseReply defaultInstance;
- public static CloseReply getDefaultInstance() {
+ private static final CloseDataChangeListenerRegistrationReply defaultInstance;
+ public static CloseDataChangeListenerRegistrationReply getDefaultInstance() {
return defaultInstance;
}
- public CloseReply getDefaultInstanceForType() {
+ public CloseDataChangeListenerRegistrationReply getDefaultInstanceForType() {
return defaultInstance;
}
getUnknownFields() {
return this.unknownFields;
}
- private CloseReply(
+ private CloseDataChangeListenerRegistrationReply(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.Builder.class);
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.Builder.class);
}
- public static com.google.protobuf.Parser<CloseReply> PARSER =
- new com.google.protobuf.AbstractParser<CloseReply>() {
- public CloseReply parsePartialFrom(
+ public static com.google.protobuf.Parser<CloseDataChangeListenerRegistrationReply> PARSER =
+ new com.google.protobuf.AbstractParser<CloseDataChangeListenerRegistrationReply>() {
+ public CloseDataChangeListenerRegistrationReply parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- return new CloseReply(input, extensionRegistry);
+ return new CloseDataChangeListenerRegistrationReply(input, extensionRegistry);
}
};
@java.lang.Override
- public com.google.protobuf.Parser<CloseReply> getParserForType() {
+ public com.google.protobuf.Parser<CloseDataChangeListenerRegistrationReply> getParserForType() {
return PARSER;
}
return super.writeReplace();
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(byte[] data)
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(java.io.InputStream input)
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom(java.io.InputStream input)
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply prototype) {
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
return builder;
}
/**
- * Protobuf type {@code org.opendaylight.controller.mdsal.CloseReply}
+ * Protobuf type {@code org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistrationReply}
+ *
+ * <pre>
+ ** reply to the CloseDataChangeListenerRegistration request
+ * </pre>
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
- implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReplyOrBuilder {
+ implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReplyOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.Builder.class);
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.Builder.class);
}
- // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.newBuilder()
+ // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply getDefaultInstanceForType() {
- return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance();
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply build() {
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply result = buildPartial();
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply build() {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
- public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply buildPartial() {
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply(this);
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply buildPartial() {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply(this);
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
- if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply) {
- return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply)other);
+ if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply)other);
} else {
super.mergeFrom(other);
return this;
}
}
- public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply other) {
- if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance()) return this;
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply other) {
+ if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.getDefaultInstance()) return this;
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parsedMessage = null;
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply) e.getUnfinishedMessage();
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
return this;
}
- // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseReply)
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistrationReply)
}
static {
- defaultInstance = new CloseReply(true);
+ defaultInstance = new CloseDataChangeListenerRegistrationReply(true);
defaultInstance.initFields();
}
- // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseReply)
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistrationReply)
+ }
+
+ public interface RegisterChangeListenerOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ boolean hasInstanceIdentifierPath();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder();
+
+ // required string dataChangeListenerActorPath = 2;
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ boolean hasDataChangeListenerActorPath();
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ java.lang.String getDataChangeListenerActorPath();
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ com.google.protobuf.ByteString
+ getDataChangeListenerActorPathBytes();
+
+ // required int32 dataChangeScope = 3;
+ /**
+ * <code>required int32 dataChangeScope = 3;</code>
+ */
+ boolean hasDataChangeScope();
+ /**
+ * <code>required int32 dataChangeScope = 3;</code>
+ */
+ int getDataChangeScope();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.RegisterChangeListener}
+ */
+ public static final class RegisterChangeListener extends
+ com.google.protobuf.GeneratedMessage
+ implements RegisterChangeListenerOrBuilder {
+ // Use RegisterChangeListener.newBuilder() to construct.
+ private RegisterChangeListener(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private RegisterChangeListener(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final RegisterChangeListener defaultInstance;
+ public static RegisterChangeListener getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public RegisterChangeListener getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private RegisterChangeListener(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ subBuilder = instanceIdentifierPath_.toBuilder();
+ }
+ instanceIdentifierPath_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierPath_);
+ instanceIdentifierPath_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000001;
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ dataChangeListenerActorPath_ = input.readBytes();
+ break;
+ }
+ case 24: {
+ bitField0_ |= 0x00000004;
+ dataChangeScope_ = input.readInt32();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<RegisterChangeListener> PARSER =
+ new com.google.protobuf.AbstractParser<RegisterChangeListener>() {
+ public RegisterChangeListener parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new RegisterChangeListener(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<RegisterChangeListener> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+ public static final int INSTANCEIDENTIFIERPATH_FIELD_NUMBER = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public boolean hasInstanceIdentifierPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() {
+ return instanceIdentifierPath_;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() {
+ return instanceIdentifierPath_;
+ }
+
+ // required string dataChangeListenerActorPath = 2;
+ public static final int DATACHANGELISTENERACTORPATH_FIELD_NUMBER = 2;
+ private java.lang.Object dataChangeListenerActorPath_;
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public boolean hasDataChangeListenerActorPath() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public java.lang.String getDataChangeListenerActorPath() {
+ java.lang.Object ref = dataChangeListenerActorPath_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ dataChangeListenerActorPath_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getDataChangeListenerActorPathBytes() {
+ java.lang.Object ref = dataChangeListenerActorPath_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ dataChangeListenerActorPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // required int32 dataChangeScope = 3;
+ public static final int DATACHANGESCOPE_FIELD_NUMBER = 3;
+ private int dataChangeScope_;
+ /**
+ * <code>required int32 dataChangeScope = 3;</code>
+ */
+ public boolean hasDataChangeScope() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required int32 dataChangeScope = 3;</code>
+ */
+ public int getDataChangeScope() {
+ return dataChangeScope_;
+ }
+
+ private void initFields() {
+ instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ dataChangeListenerActorPath_ = "";
+ dataChangeScope_ = 0;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasInstanceIdentifierPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasDataChangeListenerActorPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasDataChangeScope()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!getInstanceIdentifierPath().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeMessage(1, instanceIdentifierPath_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getDataChangeListenerActorPathBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeInt32(3, dataChangeScope_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, instanceIdentifierPath_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getDataChangeListenerActorPathBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(3, dataChangeScope_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.RegisterChangeListener}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getInstanceIdentifierPathFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ if (instanceIdentifierPathBuilder_ == null) {
+ instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierPathBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
+ dataChangeListenerActorPath_ = "";
+ bitField0_ = (bitField0_ & ~0x00000002);
+ dataChangeScope_ = 0;
+ bitField0_ = (bitField0_ & ~0x00000004);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener build() {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener buildPartial() {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ if (instanceIdentifierPathBuilder_ == null) {
+ result.instanceIdentifierPath_ = instanceIdentifierPath_;
+ } else {
+ result.instanceIdentifierPath_ = instanceIdentifierPathBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.dataChangeListenerActorPath_ = dataChangeListenerActorPath_;
+ if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+ to_bitField0_ |= 0x00000004;
+ }
+ result.dataChangeScope_ = dataChangeScope_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener other) {
+ if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.getDefaultInstance()) return this;
+ if (other.hasInstanceIdentifierPath()) {
+ mergeInstanceIdentifierPath(other.getInstanceIdentifierPath());
+ }
+ if (other.hasDataChangeListenerActorPath()) {
+ bitField0_ |= 0x00000002;
+ dataChangeListenerActorPath_ = other.dataChangeListenerActorPath_;
+ onChanged();
+ }
+ if (other.hasDataChangeScope()) {
+ setDataChangeScope(other.getDataChangeScope());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasInstanceIdentifierPath()) {
+
+ return false;
+ }
+ if (!hasDataChangeListenerActorPath()) {
+
+ return false;
+ }
+ if (!hasDataChangeScope()) {
+
+ return false;
+ }
+ if (!getInstanceIdentifierPath().isInitialized()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathBuilder_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public boolean hasInstanceIdentifierPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() {
+ if (instanceIdentifierPathBuilder_ == null) {
+ return instanceIdentifierPath_;
+ } else {
+ return instanceIdentifierPathBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public Builder setInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierPath_ = value;
+ onChanged();
+ } else {
+ instanceIdentifierPathBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public Builder setInstanceIdentifierPath(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierPathBuilder_ == null) {
+ instanceIdentifierPath_ = builderForValue.build();
+ onChanged();
+ } else {
+ instanceIdentifierPathBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public Builder mergeInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ instanceIdentifierPath_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierPath_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPath_).mergeFrom(value).buildPartial();
+ } else {
+ instanceIdentifierPath_ = value;
+ }
+ onChanged();
+ } else {
+ instanceIdentifierPathBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public Builder clearInstanceIdentifierPath() {
+ if (instanceIdentifierPathBuilder_ == null) {
+ instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ onChanged();
+ } else {
+ instanceIdentifierPathBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathBuilder() {
+ bitField0_ |= 0x00000001;
+ onChanged();
+ return getInstanceIdentifierPathFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() {
+ if (instanceIdentifierPathBuilder_ != null) {
+ return instanceIdentifierPathBuilder_.getMessageOrBuilder();
+ } else {
+ return instanceIdentifierPath_;
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierPathFieldBuilder() {
+ if (instanceIdentifierPathBuilder_ == null) {
+ instanceIdentifierPathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierPath_,
+ getParentForChildren(),
+ isClean());
+ instanceIdentifierPath_ = null;
+ }
+ return instanceIdentifierPathBuilder_;
+ }
+
+ // required string dataChangeListenerActorPath = 2;
+ private java.lang.Object dataChangeListenerActorPath_ = "";
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public boolean hasDataChangeListenerActorPath() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public java.lang.String getDataChangeListenerActorPath() {
+ java.lang.Object ref = dataChangeListenerActorPath_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ dataChangeListenerActorPath_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getDataChangeListenerActorPathBytes() {
+ java.lang.Object ref = dataChangeListenerActorPath_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ dataChangeListenerActorPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public Builder setDataChangeListenerActorPath(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ dataChangeListenerActorPath_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public Builder clearDataChangeListenerActorPath() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ dataChangeListenerActorPath_ = getDefaultInstance().getDataChangeListenerActorPath();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string dataChangeListenerActorPath = 2;</code>
+ */
+ public Builder setDataChangeListenerActorPathBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ dataChangeListenerActorPath_ = value;
+ onChanged();
+ return this;
+ }
+
+ // required int32 dataChangeScope = 3;
+ private int dataChangeScope_ ;
+ /**
+ * <code>required int32 dataChangeScope = 3;</code>
+ */
+ public boolean hasDataChangeScope() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>required int32 dataChangeScope = 3;</code>
+ */
+ public int getDataChangeScope() {
+ return dataChangeScope_;
+ }
+ /**
+ * <code>required int32 dataChangeScope = 3;</code>
+ */
+ public Builder setDataChangeScope(int value) {
+ bitField0_ |= 0x00000004;
+ dataChangeScope_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required int32 dataChangeScope = 3;</code>
+ */
+ public Builder clearDataChangeScope() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ dataChangeScope_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.RegisterChangeListener)
+ }
+
+ static {
+ defaultInstance = new RegisterChangeListener(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.RegisterChangeListener)
+ }
+
+ public interface RegisterChangeListenerReplyOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string listenerRegistrationPath = 1;
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ boolean hasListenerRegistrationPath();
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ java.lang.String getListenerRegistrationPath();
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getListenerRegistrationPathBytes();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.RegisterChangeListenerReply}
+ *
+ * <pre>
+ **
+ * This is the reply for the RegisterChangeListener message
+ * It contains the listenerRegistration actor path
+ * that can be used to unregister the listener
+ * </pre>
+ */
+ public static final class RegisterChangeListenerReply extends
+ com.google.protobuf.GeneratedMessage
+ implements RegisterChangeListenerReplyOrBuilder {
+ // Use RegisterChangeListenerReply.newBuilder() to construct.
+ private RegisterChangeListenerReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private RegisterChangeListenerReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final RegisterChangeListenerReply defaultInstance;
+ public static RegisterChangeListenerReply getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public RegisterChangeListenerReply getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private RegisterChangeListenerReply(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ listenerRegistrationPath_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<RegisterChangeListenerReply> PARSER =
+ new com.google.protobuf.AbstractParser<RegisterChangeListenerReply>() {
+ public RegisterChangeListenerReply parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new RegisterChangeListenerReply(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<RegisterChangeListenerReply> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required string listenerRegistrationPath = 1;
+ public static final int LISTENERREGISTRATIONPATH_FIELD_NUMBER = 1;
+ private java.lang.Object listenerRegistrationPath_;
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public boolean hasListenerRegistrationPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public java.lang.String getListenerRegistrationPath() {
+ java.lang.Object ref = listenerRegistrationPath_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ listenerRegistrationPath_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getListenerRegistrationPathBytes() {
+ java.lang.Object ref = listenerRegistrationPath_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ listenerRegistrationPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private void initFields() {
+ listenerRegistrationPath_ = "";
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasListenerRegistrationPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getListenerRegistrationPathBytes());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getListenerRegistrationPathBytes());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.RegisterChangeListenerReply}
+ *
+ * <pre>
+ **
+ * This is the reply for the RegisterChangeListener message
+ * It contains the listenerRegistration actor path
+ * that can be used to unregister the listener
+ * </pre>
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReplyOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ listenerRegistrationPath_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply build() {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply buildPartial() {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.listenerRegistrationPath_ = listenerRegistrationPath_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply other) {
+ if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.getDefaultInstance()) return this;
+ if (other.hasListenerRegistrationPath()) {
+ bitField0_ |= 0x00000001;
+ listenerRegistrationPath_ = other.listenerRegistrationPath_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasListenerRegistrationPath()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required string listenerRegistrationPath = 1;
+ private java.lang.Object listenerRegistrationPath_ = "";
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public boolean hasListenerRegistrationPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public java.lang.String getListenerRegistrationPath() {
+ java.lang.Object ref = listenerRegistrationPath_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ listenerRegistrationPath_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getListenerRegistrationPathBytes() {
+ java.lang.Object ref = listenerRegistrationPath_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ listenerRegistrationPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public Builder setListenerRegistrationPath(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ listenerRegistrationPath_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public Builder clearListenerRegistrationPath() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ listenerRegistrationPath_ = getDefaultInstance().getListenerRegistrationPath();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string listenerRegistrationPath = 1;</code>
+ */
+ public Builder setListenerRegistrationPathBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ listenerRegistrationPath_ = value;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.RegisterChangeListenerReply)
+ }
+
+ static {
+ defaultInstance = new RegisterChangeListenerReply(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.RegisterChangeListenerReply)
}
private static com.google.protobuf.Descriptors.Descriptor
- internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable;
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_fieldAccessorTable;
private static com.google.protobuf.Descriptors.Descriptor
- internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
- internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable;
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
static {
java.lang.String[] descriptorData = {
"\n\032ListenerRegistration.proto\022!org.openda" +
- "ylight.controller.mdsal\"\007\n\005Close\"\014\n\nClos" +
- "eReplyB[\n;org.opendaylight.controller.pr" +
- "otobuff.messages.registrationB\034ListenerR" +
- "egistrationMessages"
+ "ylight.controller.mdsal\032\014Common.proto\"%\n" +
+ "#CloseDataChangeListenerRegistration\"*\n(" +
+ "CloseDataChangeListenerRegistrationReply" +
+ "\"\255\001\n\026RegisterChangeListener\022U\n\026instanceI" +
+ "dentifierPath\030\001 \002(\01325.org.opendaylight.c" +
+ "ontroller.mdsal.InstanceIdentifier\022#\n\033da" +
+ "taChangeListenerActorPath\030\002 \002(\t\022\027\n\017dataC" +
+ "hangeScope\030\003 \002(\005\"?\n\033RegisterChangeListen" +
+ "erReply\022 \n\030listenerRegistrationPath\030\001 \002(",
+ "\tB[\n;org.opendaylight.controller.protobu" +
+ "ff.messages.registrationB\034ListenerRegist" +
+ "rationMessages"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
- internal_static_org_opendaylight_controller_mdsal_Close_descriptor =
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor =
getDescriptor().getMessageTypes().get(0);
- internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable = new
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
- internal_static_org_opendaylight_controller_mdsal_Close_descriptor,
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor,
new java.lang.String[] { });
- internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor =
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor =
getDescriptor().getMessageTypes().get(1);
- internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable = new
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
- internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor,
+ internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor,
new java.lang.String[] { });
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor =
+ getDescriptor().getMessageTypes().get(2);
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor,
+ new java.lang.String[] { "InstanceIdentifierPath", "DataChangeListenerActorPath", "DataChangeScope", });
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor =
+ getDescriptor().getMessageTypes().get(3);
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor,
+ new java.lang.String[] { "ListenerRegistrationPath", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
}, assigner);
}
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getShardNameBytes() {
java.lang.Object ref = shardName_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
shardName_ = b;
public final boolean isInitialized() {
if (!hasShardName()) {
-
+
return false;
}
return true;
getShardNameBytes() {
java.lang.Object ref = shardName_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
shardName_ = b;
public interface PrimaryFoundOrBuilder
extends com.google.protobuf.MessageOrBuilder {
+
+ // required string primaryPath = 1;
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ boolean hasPrimaryPath();
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ java.lang.String getPrimaryPath();
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getPrimaryPathBytes();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.PrimaryFound}
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
+ int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
}
break;
}
+ case 10: {
+ bitField0_ |= 0x00000001;
+ primaryPath_ = input.readBytes();
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
return PARSER;
}
+ private int bitField0_;
+ // required string primaryPath = 1;
+ public static final int PRIMARYPATH_FIELD_NUMBER = 1;
+ private java.lang.Object primaryPath_;
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public boolean hasPrimaryPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public java.lang.String getPrimaryPath() {
+ java.lang.Object ref = primaryPath_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ primaryPath_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getPrimaryPathBytes() {
+ java.lang.Object ref = primaryPath_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ primaryPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
private void initFields() {
+ primaryPath_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ if (!hasPrimaryPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getPrimaryPathBytes());
+ }
getUnknownFields().writeTo(output);
}
if (size != -1) return size;
size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getPrimaryPathBytes());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
public Builder clear() {
super.clear();
+ primaryPath_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound buildPartial() {
org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound result = new org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.primaryPath_ = primaryPath_;
+ result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound other) {
if (other == org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.getDefaultInstance()) return this;
+ if (other.hasPrimaryPath()) {
+ bitField0_ |= 0x00000001;
+ primaryPath_ = other.primaryPath_;
+ onChanged();
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
+ if (!hasPrimaryPath()) {
+
+ return false;
+ }
return true;
}
}
return this;
}
+ private int bitField0_;
+
+ // required string primaryPath = 1;
+ private java.lang.Object primaryPath_ = "";
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public boolean hasPrimaryPath() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public java.lang.String getPrimaryPath() {
+ java.lang.Object ref = primaryPath_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ primaryPath_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getPrimaryPathBytes() {
+ java.lang.Object ref = primaryPath_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ primaryPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public Builder setPrimaryPath(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ primaryPath_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public Builder clearPrimaryPath() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ primaryPath_ = getDefaultInstance().getPrimaryPath();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string primaryPath = 1;</code>
+ */
+ public Builder setPrimaryPathBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ primaryPath_ = value;
+ onChanged();
+ return this;
+ }
// @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PrimaryFound)
}
public interface PrimaryNotFoundOrBuilder
extends com.google.protobuf.MessageOrBuilder {
+
+ // required string shardName = 1;
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ boolean hasShardName();
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ java.lang.String getShardName();
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getShardNameBytes();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.PrimaryNotFound}
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
+ int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
}
break;
}
+ case 10: {
+ bitField0_ |= 0x00000001;
+ shardName_ = input.readBytes();
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
return PARSER;
}
+ private int bitField0_;
+ // required string shardName = 1;
+ public static final int SHARDNAME_FIELD_NUMBER = 1;
+ private java.lang.Object shardName_;
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public boolean hasShardName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public java.lang.String getShardName() {
+ java.lang.Object ref = shardName_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ shardName_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getShardNameBytes() {
+ java.lang.Object ref = shardName_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ shardName_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
private void initFields() {
+ shardName_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ if (!hasShardName()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getShardNameBytes());
+ }
getUnknownFields().writeTo(output);
}
if (size != -1) return size;
size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getShardNameBytes());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
public Builder clear() {
super.clear();
+ shardName_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound buildPartial() {
org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound result = new org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.shardName_ = shardName_;
+ result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound other) {
if (other == org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.getDefaultInstance()) return this;
+ if (other.hasShardName()) {
+ bitField0_ |= 0x00000001;
+ shardName_ = other.shardName_;
+ onChanged();
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
+ if (!hasShardName()) {
+
+ return false;
+ }
return true;
}
}
return this;
}
+ private int bitField0_;
+
+ // required string shardName = 1;
+ private java.lang.Object shardName_ = "";
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public boolean hasShardName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public java.lang.String getShardName() {
+ java.lang.Object ref = shardName_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ shardName_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getShardNameBytes() {
+ java.lang.Object ref = shardName_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ shardName_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public Builder setShardName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ shardName_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public Builder clearShardName() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ shardName_ = getDefaultInstance().getShardName();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string shardName = 1;</code>
+ */
+ public Builder setShardNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ shardName_ = value;
+ onChanged();
+ return this;
+ }
// @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PrimaryNotFound)
}
java.lang.String[] descriptorData = {
"\n\022ShardManager.proto\022!org.opendaylight.c" +
"ontroller.mdsal\" \n\013FindPrimary\022\021\n\tshardN" +
- "ame\030\001 \002(\t\"\016\n\014PrimaryFound\"\021\n\017PrimaryNotF" +
- "oundBL\n4org.opendaylight.controller.prot" +
+ "ame\030\001 \002(\t\"#\n\014PrimaryFound\022\023\n\013primaryPath" +
+ "\030\001 \002(\t\"$\n\017PrimaryNotFound\022\021\n\tshardName\030\001" +
+ " \002(\tBL\n4org.opendaylight.controller.prot" +
"obuff.messages.shardB\024ShardManagerMessag" +
"es"
};
internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor,
- new java.lang.String[] { });
+ new java.lang.String[] { "PrimaryPath", });
internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor,
- new java.lang.String[] { });
+ new java.lang.String[] { "ShardName", });
return null;
}
};
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTransactionChainPathBytes() {
java.lang.Object ref = transactionChainPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionChainPath_ = b;
public final boolean isInitialized() {
if (!hasTransactionChainPath()) {
-
+
return false;
}
return true;
getTransactionChainPathBytes() {
java.lang.Object ref = transactionChainPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionChainPath_ = b;
public interface CreateTransactionOrBuilder
extends com.google.protobuf.MessageOrBuilder {
+
+ // required string transactionId = 1;
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ boolean hasTransactionId();
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ java.lang.String getTransactionId();
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getTransactionIdBytes();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransaction}
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
+ int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
}
break;
}
+ case 10: {
+ bitField0_ |= 0x00000001;
+ transactionId_ = input.readBytes();
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
return PARSER;
}
+ private int bitField0_;
+ // required string transactionId = 1;
+ public static final int TRANSACTIONID_FIELD_NUMBER = 1;
+ private java.lang.Object transactionId_;
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public boolean hasTransactionId() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public java.lang.String getTransactionId() {
+ java.lang.Object ref = transactionId_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ transactionId_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTransactionIdBytes() {
+ java.lang.Object ref = transactionId_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ transactionId_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
private void initFields() {
+ transactionId_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ if (!hasTransactionId()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getTransactionIdBytes());
+ }
getUnknownFields().writeTo(output);
}
if (size != -1) return size;
size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getTransactionIdBytes());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
public Builder clear() {
super.clear();
+ transactionId_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction buildPartial() {
org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.transactionId_ = transactionId_;
+ result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction other) {
if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.getDefaultInstance()) return this;
+ if (other.hasTransactionId()) {
+ bitField0_ |= 0x00000001;
+ transactionId_ = other.transactionId_;
+ onChanged();
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
+ if (!hasTransactionId()) {
+
+ return false;
+ }
return true;
}
}
return this;
}
+ private int bitField0_;
+
+ // required string transactionId = 1;
+ private java.lang.Object transactionId_ = "";
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public boolean hasTransactionId() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public java.lang.String getTransactionId() {
+ java.lang.Object ref = transactionId_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ transactionId_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTransactionIdBytes() {
+ java.lang.Object ref = transactionId_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ transactionId_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public Builder setTransactionId(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ transactionId_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public Builder clearTransactionId() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ transactionId_ = getDefaultInstance().getTransactionId();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string transactionId = 1;</code>
+ */
+ public Builder setTransactionIdBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ transactionId_ = value;
+ onChanged();
+ return this;
+ }
// @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransaction)
}
public interface CreateTransactionReplyOrBuilder
extends com.google.protobuf.MessageOrBuilder {
- // required string transactionPath = 1;
+ // required string transactionActorPath = 1;
+ /**
+ * <code>required string transactionActorPath = 1;</code>
+ */
+ boolean hasTransactionActorPath();
+ /**
+ * <code>required string transactionActorPath = 1;</code>
+ */
+ java.lang.String getTransactionActorPath();
+ /**
+ * <code>required string transactionActorPath = 1;</code>
+ */
+ com.google.protobuf.ByteString
+ getTransactionActorPathBytes();
+
+ // required string transactionId = 2;
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionId = 2;</code>
*/
- boolean hasTransactionPath();
+ boolean hasTransactionId();
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionId = 2;</code>
*/
- java.lang.String getTransactionPath();
+ java.lang.String getTransactionId();
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionId = 2;</code>
*/
com.google.protobuf.ByteString
- getTransactionPathBytes();
+ getTransactionIdBytes();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransactionReply}
}
case 10: {
bitField0_ |= 0x00000001;
- transactionPath_ = input.readBytes();
+ transactionActorPath_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ transactionId_ = input.readBytes();
break;
}
}
}
private int bitField0_;
- // required string transactionPath = 1;
- public static final int TRANSACTIONPATH_FIELD_NUMBER = 1;
- private java.lang.Object transactionPath_;
+ // required string transactionActorPath = 1;
+ public static final int TRANSACTIONACTORPATH_FIELD_NUMBER = 1;
+ private java.lang.Object transactionActorPath_;
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionActorPath = 1;</code>
*/
- public boolean hasTransactionPath() {
+ public boolean hasTransactionActorPath() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionActorPath = 1;</code>
+ */
+ public java.lang.String getTransactionActorPath() {
+ java.lang.Object ref = transactionActorPath_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ transactionActorPath_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * <code>required string transactionActorPath = 1;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTransactionActorPathBytes() {
+ java.lang.Object ref = transactionActorPath_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ transactionActorPath_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // required string transactionId = 2;
+ public static final int TRANSACTIONID_FIELD_NUMBER = 2;
+ private java.lang.Object transactionId_;
+ /**
+ * <code>required string transactionId = 2;</code>
+ */
+ public boolean hasTransactionId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required string transactionId = 2;</code>
*/
- public java.lang.String getTransactionPath() {
- java.lang.Object ref = transactionPath_;
+ public java.lang.String getTransactionId() {
+ java.lang.Object ref = transactionId_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
- transactionPath_ = s;
+ transactionId_ = s;
}
return s;
}
}
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionId = 2;</code>
*/
public com.google.protobuf.ByteString
- getTransactionPathBytes() {
- java.lang.Object ref = transactionPath_;
+ getTransactionIdBytes() {
+ java.lang.Object ref = transactionId_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
- transactionPath_ = b;
+ transactionId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
private void initFields() {
- transactionPath_ = "";
+ transactionActorPath_ = "";
+ transactionId_ = "";
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
- if (!hasTransactionPath()) {
+ if (!hasTransactionActorPath()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasTransactionId()) {
memoizedIsInitialized = 0;
return false;
}
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeBytes(1, getTransactionPathBytes());
+ output.writeBytes(1, getTransactionActorPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getTransactionIdBytes());
}
getUnknownFields().writeTo(output);
}
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(1, getTransactionPathBytes());
+ .computeBytesSize(1, getTransactionActorPathBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getTransactionIdBytes());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
public Builder clear() {
super.clear();
- transactionPath_ = "";
+ transactionActorPath_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
+ transactionId_ = "";
+ bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
- result.transactionPath_ = transactionPath_;
+ result.transactionActorPath_ = transactionActorPath_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.transactionId_ = transactionId_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply other) {
if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply.getDefaultInstance()) return this;
- if (other.hasTransactionPath()) {
+ if (other.hasTransactionActorPath()) {
bitField0_ |= 0x00000001;
- transactionPath_ = other.transactionPath_;
+ transactionActorPath_ = other.transactionActorPath_;
+ onChanged();
+ }
+ if (other.hasTransactionId()) {
+ bitField0_ |= 0x00000002;
+ transactionId_ = other.transactionId_;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
}
public final boolean isInitialized() {
- if (!hasTransactionPath()) {
-
+ if (!hasTransactionActorPath()) {
+
+ return false;
+ }
+ if (!hasTransactionId()) {
+
return false;
}
return true;
}
private int bitField0_;
- // required string transactionPath = 1;
- private java.lang.Object transactionPath_ = "";
+ // required string transactionActorPath = 1;
+ private java.lang.Object transactionActorPath_ = "";
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionActorPath = 1;</code>
*/
- public boolean hasTransactionPath() {
+ public boolean hasTransactionActorPath() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionActorPath = 1;</code>
*/
- public java.lang.String getTransactionPath() {
- java.lang.Object ref = transactionPath_;
+ public java.lang.String getTransactionActorPath() {
+ java.lang.Object ref = transactionActorPath_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
- transactionPath_ = s;
+ transactionActorPath_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionActorPath = 1;</code>
*/
public com.google.protobuf.ByteString
- getTransactionPathBytes() {
- java.lang.Object ref = transactionPath_;
+ getTransactionActorPathBytes() {
+ java.lang.Object ref = transactionActorPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
- transactionPath_ = b;
+ transactionActorPath_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionActorPath = 1;</code>
*/
- public Builder setTransactionPath(
+ public Builder setTransactionActorPath(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
- transactionPath_ = value;
+ transactionActorPath_ = value;
onChanged();
return this;
}
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionActorPath = 1;</code>
*/
- public Builder clearTransactionPath() {
+ public Builder clearTransactionActorPath() {
bitField0_ = (bitField0_ & ~0x00000001);
- transactionPath_ = getDefaultInstance().getTransactionPath();
+ transactionActorPath_ = getDefaultInstance().getTransactionActorPath();
onChanged();
return this;
}
/**
- * <code>required string transactionPath = 1;</code>
+ * <code>required string transactionActorPath = 1;</code>
*/
- public Builder setTransactionPathBytes(
+ public Builder setTransactionActorPathBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
- transactionPath_ = value;
+ transactionActorPath_ = value;
+ onChanged();
+ return this;
+ }
+
+ // required string transactionId = 2;
+ private java.lang.Object transactionId_ = "";
+ /**
+ * <code>required string transactionId = 2;</code>
+ */
+ public boolean hasTransactionId() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required string transactionId = 2;</code>
+ */
+ public java.lang.String getTransactionId() {
+ java.lang.Object ref = transactionId_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ transactionId_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>required string transactionId = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getTransactionIdBytes() {
+ java.lang.Object ref = transactionId_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ transactionId_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>required string transactionId = 2;</code>
+ */
+ public Builder setTransactionId(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ transactionId_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string transactionId = 2;</code>
+ */
+ public Builder clearTransactionId() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ transactionId_ = getDefaultInstance().getTransactionId();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>required string transactionId = 2;</code>
+ */
+ public Builder setTransactionIdBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ transactionId_ = value;
onChanged();
return this;
}
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getActorPathBytes() {
java.lang.Object ref = actorPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
actorPath_ = b;
public final boolean isInitialized() {
if (!hasActorPath()) {
-
+
return false;
}
return true;
getActorPathBytes() {
java.lang.Object ref = actorPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
actorPath_ = b;
public interface DeleteDataOrBuilder
extends com.google.protobuf.MessageOrBuilder {
- // repeated string instanceIdentifierPathArguments = 1;
- /**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
- */
- java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList();
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- int getInstanceIdentifierPathArgumentsCount();
+ boolean hasInstanceIdentifierPathArguments();
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- java.lang.String getInstanceIdentifierPathArguments(int index);
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments();
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index);
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.DeleteData}
break;
}
case 10: {
- if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
- mutable_bitField0_ |= 0x00000001;
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ subBuilder = instanceIdentifierPathArguments_.toBuilder();
+ }
+ instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierPathArguments_);
+ instanceIdentifierPathArguments_ = subBuilder.buildPartial();
}
- instanceIdentifierPathArguments_.add(input.readBytes());
+ bitField0_ |= 0x00000001;
break;
}
}
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
- if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
- }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
return PARSER;
}
- // repeated string instanceIdentifierPathArguments = 1;
+ private int bitField0_;
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
- private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_;
- /**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
- */
- public java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList() {
- return instanceIdentifierPathArguments_;
- }
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public int getInstanceIdentifierPathArgumentsCount() {
- return instanceIdentifierPathArguments_.size();
+ public boolean hasInstanceIdentifierPathArguments() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public java.lang.String getInstanceIdentifierPathArguments(int index) {
- return instanceIdentifierPathArguments_.get(index);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+ return instanceIdentifierPathArguments_;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index) {
- return instanceIdentifierPathArguments_.getByteString(index);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+ return instanceIdentifierPathArguments_;
}
private void initFields() {
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ if (!hasInstanceIdentifierPathArguments()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!getInstanceIdentifierPathArguments().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
- for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
- output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i));
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeMessage(1, instanceIdentifierPathArguments_);
}
getUnknownFields().writeTo(output);
}
if (size != -1) return size;
size = 0;
- {
- int dataSize = 0;
- for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
- dataSize += com.google.protobuf.CodedOutputStream
- .computeBytesSizeNoTag(instanceIdentifierPathArguments_.getByteString(i));
- }
- size += dataSize;
- size += 1 * getInstanceIdentifierPathArgumentsList().size();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, instanceIdentifierPathArguments_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getInstanceIdentifierPathArgumentsFieldBuilder();
}
}
private static Builder create() {
public Builder clear() {
super.clear();
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.clear();
+ }
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData buildPartial() {
org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData(this);
int from_bitField0_ = bitField0_;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(
- instanceIdentifierPathArguments_);
- bitField0_ = (bitField0_ & ~0x00000001);
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+ } else {
+ result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build();
}
- result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+ result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData other) {
if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.getDefaultInstance()) return this;
- if (!other.instanceIdentifierPathArguments_.isEmpty()) {
- if (instanceIdentifierPathArguments_.isEmpty()) {
- instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_;
- bitField0_ = (bitField0_ & ~0x00000001);
- } else {
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.addAll(other.instanceIdentifierPathArguments_);
- }
- onChanged();
+ if (other.hasInstanceIdentifierPathArguments()) {
+ mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
+ if (!hasInstanceIdentifierPathArguments()) {
+
+ return false;
+ }
+ if (!getInstanceIdentifierPathArguments().isInitialized()) {
+
+ return false;
+ }
return true;
}
}
private int bitField0_;
- // repeated string instanceIdentifierPathArguments = 1;
- private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- private void ensureInstanceIdentifierPathArgumentsIsMutable() {
- if (!((bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList(instanceIdentifierPathArguments_);
- bitField0_ |= 0x00000001;
- }
- }
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList() {
- return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+ public boolean hasInstanceIdentifierPathArguments() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public int getInstanceIdentifierPathArgumentsCount() {
- return instanceIdentifierPathArguments_.size();
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ return instanceIdentifierPathArguments_;
+ } else {
+ return instanceIdentifierPathArgumentsBuilder_.getMessage();
+ }
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public java.lang.String getInstanceIdentifierPathArguments(int index) {
- return instanceIdentifierPathArguments_.get(index);
+ public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierPathArguments_ = value;
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index) {
- return instanceIdentifierPathArguments_.getByteString(index);
+ public Builder setInstanceIdentifierPathArguments(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = builderForValue.build();
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder setInstanceIdentifierPathArguments(
- int index, java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.set(index, value);
- onChanged();
+ public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierPathArguments_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial();
+ } else {
+ instanceIdentifierPathArguments_ = value;
+ }
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder addInstanceIdentifierPathArguments(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.add(value);
- onChanged();
+ public Builder clearInstanceIdentifierPathArguments() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder addAllInstanceIdentifierPathArguments(
- java.lang.Iterable<java.lang.String> values) {
- ensureInstanceIdentifierPathArgumentsIsMutable();
- super.addAll(values, instanceIdentifierPathArguments_);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() {
+ bitField0_ |= 0x00000001;
onChanged();
- return this;
+ return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder();
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder clearInstanceIdentifierPathArguments() {
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- bitField0_ = (bitField0_ & ~0x00000001);
- onChanged();
- return this;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+ if (instanceIdentifierPathArgumentsBuilder_ != null) {
+ return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder();
+ } else {
+ return instanceIdentifierPathArguments_;
+ }
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder addInstanceIdentifierPathArgumentsBytes(
- com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.add(value);
- onChanged();
- return this;
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierPathArgumentsFieldBuilder() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierPathArguments_,
+ getParentForChildren(),
+ isClean());
+ instanceIdentifierPathArguments_ = null;
+ }
+ return instanceIdentifierPathArgumentsBuilder_;
}
// @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteData)
public interface ReadDataOrBuilder
extends com.google.protobuf.MessageOrBuilder {
- // required string instanceIdentifierPathArguments = 1;
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
boolean hasInstanceIdentifierPathArguments();
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- java.lang.String getInstanceIdentifierPathArguments();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments();
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.ReadData}
break;
}
case 10: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ subBuilder = instanceIdentifierPathArguments_.toBuilder();
+ }
+ instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierPathArguments_);
+ instanceIdentifierPathArguments_ = subBuilder.buildPartial();
+ }
bitField0_ |= 0x00000001;
- instanceIdentifierPathArguments_ = input.readBytes();
break;
}
}
}
private int bitField0_;
- // required string instanceIdentifierPathArguments = 1;
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
- private java.lang.Object instanceIdentifierPathArguments_;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_;
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
public boolean hasInstanceIdentifierPathArguments() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public java.lang.String getInstanceIdentifierPathArguments() {
- java.lang.Object ref = instanceIdentifierPathArguments_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- } else {
- com.google.protobuf.ByteString bs =
- (com.google.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- instanceIdentifierPathArguments_ = s;
- }
- return s;
- }
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+ return instanceIdentifierPathArguments_;
}
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes() {
- java.lang.Object ref = instanceIdentifierPathArguments_;
- if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
- com.google.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- instanceIdentifierPathArguments_ = b;
- return b;
- } else {
- return (com.google.protobuf.ByteString) ref;
- }
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+ return instanceIdentifierPathArguments_;
}
private void initFields() {
- instanceIdentifierPathArguments_ = "";
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
memoizedIsInitialized = 0;
return false;
}
+ if (!getInstanceIdentifierPathArguments().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
memoizedIsInitialized = 1;
return true;
}
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeBytes(1, getInstanceIdentifierPathArgumentsBytes());
+ output.writeMessage(1, instanceIdentifierPathArguments_);
}
getUnknownFields().writeTo(output);
}
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(1, getInstanceIdentifierPathArgumentsBytes());
+ .computeMessageSize(1, instanceIdentifierPathArguments_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getInstanceIdentifierPathArgumentsFieldBuilder();
}
}
private static Builder create() {
public Builder clear() {
super.clear();
- instanceIdentifierPathArguments_ = "";
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.clear();
+ }
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
- result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+ } else {
+ result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build();
+ }
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData other) {
if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.getDefaultInstance()) return this;
if (other.hasInstanceIdentifierPathArguments()) {
- bitField0_ |= 0x00000001;
- instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_;
- onChanged();
+ mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
public final boolean isInitialized() {
if (!hasInstanceIdentifierPathArguments()) {
-
+
+ return false;
+ }
+ if (!getInstanceIdentifierPathArguments().isInitialized()) {
+
return false;
}
return true;
}
private int bitField0_;
- // required string instanceIdentifierPathArguments = 1;
- private java.lang.Object instanceIdentifierPathArguments_ = "";
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_;
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
public boolean hasInstanceIdentifierPathArguments() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public java.lang.String getInstanceIdentifierPathArguments() {
- java.lang.Object ref = instanceIdentifierPathArguments_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((com.google.protobuf.ByteString) ref)
- .toStringUtf8();
- instanceIdentifierPathArguments_ = s;
- return s;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ return instanceIdentifierPathArguments_;
} else {
- return (java.lang.String) ref;
+ return instanceIdentifierPathArgumentsBuilder_.getMessage();
}
}
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes() {
- java.lang.Object ref = instanceIdentifierPathArguments_;
- if (ref instanceof String) {
- com.google.protobuf.ByteString b =
- com.google.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- instanceIdentifierPathArguments_ = b;
- return b;
+ public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierPathArguments_ = value;
+ onChanged();
} else {
- return (com.google.protobuf.ByteString) ref;
+ instanceIdentifierPathArgumentsBuilder_.setMessage(value);
}
+ bitField0_ |= 0x00000001;
+ return this;
}
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
public Builder setInstanceIdentifierPathArguments(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000001;
- instanceIdentifierPathArguments_ = value;
- onChanged();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = builderForValue.build();
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierPathArguments_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial();
+ } else {
+ instanceIdentifierPathArguments_ = value;
+ }
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
return this;
}
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
public Builder clearInstanceIdentifierPathArguments() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.clear();
+ }
bitField0_ = (bitField0_ & ~0x00000001);
- instanceIdentifierPathArguments_ = getDefaultInstance().getInstanceIdentifierPathArguments();
- onChanged();
return this;
}
/**
- * <code>required string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder setInstanceIdentifierPathArgumentsBytes(
- com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000001;
- instanceIdentifierPathArguments_ = value;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() {
+ bitField0_ |= 0x00000001;
onChanged();
- return this;
+ return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+ if (instanceIdentifierPathArgumentsBuilder_ != null) {
+ return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder();
+ } else {
+ return instanceIdentifierPathArguments_;
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierPathArgumentsFieldBuilder() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierPathArguments_,
+ getParentForChildren(),
+ isClean());
+ instanceIdentifierPathArguments_ = null;
+ }
+ return instanceIdentifierPathArgumentsBuilder_;
}
// @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadData)
public interface ReadDataReplyOrBuilder
extends com.google.protobuf.MessageOrBuilder {
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
boolean hasNormalizedNode();
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.ReadDataReply}
break;
}
case 10: {
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
subBuilder = normalizedNode_.toBuilder();
}
- normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+ normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(normalizedNode_);
normalizedNode_ = subBuilder.buildPartial();
}
private int bitField0_;
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;
public static final int NORMALIZEDNODE_FIELD_NUMBER = 1;
- private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
public boolean hasNormalizedNode() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
return normalizedNode_;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
return normalizedNode_;
}
private void initFields() {
- normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
- if (!hasNormalizedNode()) {
- memoizedIsInitialized = 0;
- return false;
- }
- if (!getNormalizedNode().isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
+ if (hasNormalizedNode()) {
+ if (!getNormalizedNode().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
}
memoizedIsInitialized = 1;
return true;
public Builder clear() {
super.clear();
if (normalizedNodeBuilder_ == null) {
- normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
} else {
normalizedNodeBuilder_.clear();
}
}
public final boolean isInitialized() {
- if (!hasNormalizedNode()) {
-
- return false;
- }
- if (!getNormalizedNode().isInitialized()) {
-
- return false;
+ if (hasNormalizedNode()) {
+ if (!getNormalizedNode().isInitialized()) {
+
+ return false;
+ }
}
return true;
}
}
private int bitField0_;
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;
- private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder> normalizedNodeBuilder_;
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
public boolean hasNormalizedNode() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
if (normalizedNodeBuilder_ == null) {
return normalizedNode_;
} else {
}
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+ public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
if (normalizedNodeBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
public Builder setNormalizedNode(
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
if (normalizedNodeBuilder_ == null) {
normalizedNode_ = builderForValue.build();
onChanged();
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+ public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
if (normalizedNodeBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001) &&
- normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance()) {
+ normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
normalizedNode_ =
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
} else {
normalizedNode_ = value;
}
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
public Builder clearNormalizedNode() {
if (normalizedNodeBuilder_ == null) {
- normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
onChanged();
} else {
normalizedNodeBuilder_.clear();
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeBuilder() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
bitField0_ |= 0x00000001;
onChanged();
return getNormalizedNodeFieldBuilder().getBuilder();
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
if (normalizedNodeBuilder_ != null) {
return normalizedNodeBuilder_.getMessageOrBuilder();
} else {
}
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getNormalizedNodeFieldBuilder() {
if (normalizedNodeBuilder_ == null) {
normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
normalizedNode_,
getParentForChildren(),
isClean());
public interface WriteDataOrBuilder
extends com.google.protobuf.MessageOrBuilder {
- // repeated string instanceIdentifierPathArguments = 1;
- /**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
- */
- java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList();
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- int getInstanceIdentifierPathArgumentsCount();
+ boolean hasInstanceIdentifierPathArguments();
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- java.lang.String getInstanceIdentifierPathArguments(int index);
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments();
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index);
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder();
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;
+ // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
boolean hasNormalizedNode();
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.WriteData}
break;
}
case 10: {
- if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
- mutable_bitField0_ |= 0x00000001;
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ subBuilder = instanceIdentifierPathArguments_.toBuilder();
}
- instanceIdentifierPathArguments_.add(input.readBytes());
+ instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierPathArguments_);
+ instanceIdentifierPathArguments_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000001;
break;
}
case 18: {
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
subBuilder = normalizedNode_.toBuilder();
}
- normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+ normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(normalizedNode_);
normalizedNode_ = subBuilder.buildPartial();
}
- bitField0_ |= 0x00000001;
+ bitField0_ |= 0x00000002;
break;
}
}
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
- if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
- }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
private int bitField0_;
- // repeated string instanceIdentifierPathArguments = 1;
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
- private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_;
- /**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
- */
- public java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList() {
- return instanceIdentifierPathArguments_;
- }
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public int getInstanceIdentifierPathArgumentsCount() {
- return instanceIdentifierPathArguments_.size();
+ public boolean hasInstanceIdentifierPathArguments() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public java.lang.String getInstanceIdentifierPathArguments(int index) {
- return instanceIdentifierPathArguments_.get(index);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+ return instanceIdentifierPathArguments_;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index) {
- return instanceIdentifierPathArguments_.getByteString(index);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+ return instanceIdentifierPathArguments_;
}
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;
+ // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
- private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
public boolean hasNormalizedNode() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
+ return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
return normalizedNode_;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
return normalizedNode_;
}
private void initFields() {
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ if (!hasInstanceIdentifierPathArguments()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
if (!hasNormalizedNode()) {
memoizedIsInitialized = 0;
return false;
}
+ if (!getInstanceIdentifierPathArguments().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
if (!getNormalizedNode().isInitialized()) {
memoizedIsInitialized = 0;
return false;
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
- for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
- output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i));
- }
if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeMessage(1, instanceIdentifierPathArguments_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, normalizedNode_);
}
getUnknownFields().writeTo(output);
if (size != -1) return size;
size = 0;
- {
- int dataSize = 0;
- for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
- dataSize += com.google.protobuf.CodedOutputStream
- .computeBytesSizeNoTag(instanceIdentifierPathArguments_.getByteString(i));
- }
- size += dataSize;
- size += 1 * getInstanceIdentifierPathArgumentsList().size();
- }
if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, instanceIdentifierPathArguments_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, normalizedNode_);
}
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getInstanceIdentifierPathArgumentsFieldBuilder();
getNormalizedNodeFieldBuilder();
}
}
public Builder clear() {
super.clear();
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.clear();
+ }
bitField0_ = (bitField0_ & ~0x00000001);
if (normalizedNodeBuilder_ == null) {
- normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
} else {
normalizedNodeBuilder_.clear();
}
org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(
- instanceIdentifierPathArguments_);
- bitField0_ = (bitField0_ & ~0x00000001);
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+ } else {
+ result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build();
}
- result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
- to_bitField0_ |= 0x00000001;
+ to_bitField0_ |= 0x00000002;
}
if (normalizedNodeBuilder_ == null) {
result.normalizedNode_ = normalizedNode_;
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData other) {
if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.getDefaultInstance()) return this;
- if (!other.instanceIdentifierPathArguments_.isEmpty()) {
- if (instanceIdentifierPathArguments_.isEmpty()) {
- instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_;
- bitField0_ = (bitField0_ & ~0x00000001);
- } else {
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.addAll(other.instanceIdentifierPathArguments_);
- }
- onChanged();
+ if (other.hasInstanceIdentifierPathArguments()) {
+ mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments());
}
if (other.hasNormalizedNode()) {
mergeNormalizedNode(other.getNormalizedNode());
}
public final boolean isInitialized() {
+ if (!hasInstanceIdentifierPathArguments()) {
+
+ return false;
+ }
if (!hasNormalizedNode()) {
-
+
+ return false;
+ }
+ if (!getInstanceIdentifierPathArguments().isInitialized()) {
+
return false;
}
if (!getNormalizedNode().isInitialized()) {
-
+
return false;
}
return true;
}
private int bitField0_;
- // repeated string instanceIdentifierPathArguments = 1;
- private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- private void ensureInstanceIdentifierPathArgumentsIsMutable() {
- if (!((bitField0_ & 0x00000001) == 0x00000001)) {
- instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList(instanceIdentifierPathArguments_);
- bitField0_ |= 0x00000001;
- }
- }
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public java.util.List<java.lang.String>
- getInstanceIdentifierPathArgumentsList() {
- return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+ public boolean hasInstanceIdentifierPathArguments() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public int getInstanceIdentifierPathArgumentsCount() {
- return instanceIdentifierPathArguments_.size();
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ return instanceIdentifierPathArguments_;
+ } else {
+ return instanceIdentifierPathArgumentsBuilder_.getMessage();
+ }
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public java.lang.String getInstanceIdentifierPathArguments(int index) {
- return instanceIdentifierPathArguments_.get(index);
+ public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierPathArguments_ = value;
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public com.google.protobuf.ByteString
- getInstanceIdentifierPathArgumentsBytes(int index) {
- return instanceIdentifierPathArguments_.getByteString(index);
- }
+ public Builder setInstanceIdentifierPathArguments(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = builderForValue.build();
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierPathArguments_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial();
+ } else {
+ instanceIdentifierPathArguments_ = value;
+ }
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public Builder clearInstanceIdentifierPathArguments() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() {
+ bitField0_ |= 0x00000001;
+ onChanged();
+ return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+ if (instanceIdentifierPathArgumentsBuilder_ != null) {
+ return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder();
+ } else {
+ return instanceIdentifierPathArguments_;
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierPathArgumentsFieldBuilder() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierPathArguments_,
+ getParentForChildren(),
+ isClean());
+ instanceIdentifierPathArguments_ = null;
+ }
+ return instanceIdentifierPathArgumentsBuilder_;
+ }
+
+ // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public boolean hasNormalizedNode() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+ if (normalizedNodeBuilder_ == null) {
+ return normalizedNode_;
+ } else {
+ return normalizedNodeBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (normalizedNodeBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ normalizedNode_ = value;
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder setNormalizedNode(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = builderForValue.build();
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+ if (normalizedNodeBuilder_ == null) {
+ if (((bitField0_ & 0x00000002) == 0x00000002) &&
+ normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+ normalizedNode_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+ } else {
+ normalizedNode_ = value;
+ }
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000002;
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public Builder clearNormalizedNode() {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ onChanged();
+ } else {
+ normalizedNodeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
+ bitField0_ |= 0x00000002;
+ onChanged();
+ return getNormalizedNodeFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+ if (normalizedNodeBuilder_ != null) {
+ return normalizedNodeBuilder_.getMessageOrBuilder();
+ } else {
+ return normalizedNode_;
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ getNormalizedNodeFieldBuilder() {
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+ normalizedNode_,
+ getParentForChildren(),
+ isClean());
+ normalizedNode_ = null;
+ }
+ return normalizedNodeBuilder_;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.WriteData)
+ }
+
+ static {
+ defaultInstance = new WriteData(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.WriteData)
+ }
+
+ public interface WriteDataReplyOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.WriteDataReply}
+ */
+ public static final class WriteDataReply extends
+ com.google.protobuf.GeneratedMessage
+ implements WriteDataReplyOrBuilder {
+ // Use WriteDataReply.newBuilder() to construct.
+ private WriteDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private WriteDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final WriteDataReply defaultInstance;
+ public static WriteDataReply getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public WriteDataReply getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private WriteDataReply(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<WriteDataReply> PARSER =
+ new com.google.protobuf.AbstractParser<WriteDataReply>() {
+ public WriteDataReply parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new WriteDataReply(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<WriteDataReply> getParserForType() {
+ return PARSER;
+ }
+
+ private void initFields() {
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.WriteDataReply}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReplyOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply build() {
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply buildPartial() {
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply(this);
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply other) {
+ if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.getDefaultInstance()) return this;
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.WriteDataReply)
+ }
+
+ static {
+ defaultInstance = new WriteDataReply(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.WriteDataReply)
+ }
+
+ public interface MergeDataOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ boolean hasInstanceIdentifierPathArguments();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder();
+
+ // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ boolean hasNormalizedNode();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.MergeData}
+ */
+ public static final class MergeData extends
+ com.google.protobuf.GeneratedMessage
+ implements MergeDataOrBuilder {
+ // Use MergeData.newBuilder() to construct.
+ private MergeData(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private MergeData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final MergeData defaultInstance;
+ public static MergeData getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public MergeData getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private MergeData(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ subBuilder = instanceIdentifierPathArguments_.toBuilder();
+ }
+ instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierPathArguments_);
+ instanceIdentifierPathArguments_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000001;
+ break;
+ }
+ case 18: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ subBuilder = normalizedNode_.toBuilder();
+ }
+ normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(normalizedNode_);
+ normalizedNode_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000002;
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.Builder.class);
+ }
+
+ public static com.google.protobuf.Parser<MergeData> PARSER =
+ new com.google.protobuf.AbstractParser<MergeData>() {
+ public MergeData parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new MergeData(input, extensionRegistry);
+ }
+ };
+
+ @java.lang.Override
+ public com.google.protobuf.Parser<MergeData> getParserForType() {
+ return PARSER;
+ }
+
+ private int bitField0_;
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+ public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public boolean hasInstanceIdentifierPathArguments() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+ return instanceIdentifierPathArguments_;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+ return instanceIdentifierPathArguments_;
+ }
+
+ // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public boolean hasNormalizedNode() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+ return normalizedNode_;
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+ return normalizedNode_;
+ }
+
+ private void initFields() {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasInstanceIdentifierPathArguments()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasNormalizedNode()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!getInstanceIdentifierPathArguments().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!getNormalizedNode().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeMessage(1, instanceIdentifierPathArguments_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeMessage(2, normalizedNode_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, instanceIdentifierPathArguments_);
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(2, normalizedNode_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.opendaylight.controller.mdsal.MergeData}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.Builder.class);
+ }
+
+ // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ getInstanceIdentifierPathArgumentsFieldBuilder();
+ getNormalizedNodeFieldBuilder();
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
+ if (normalizedNodeBuilder_ == null) {
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+ } else {
+ normalizedNodeBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.getDefaultInstance();
+ }
+
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData build() {
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData buildPartial() {
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+ } else {
+ result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build();
+ }
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ if (normalizedNodeBuilder_ == null) {
+ result.normalizedNode_ = normalizedNode_;
+ } else {
+ result.normalizedNode_ = normalizedNodeBuilder_.build();
+ }
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData other) {
+ if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.getDefaultInstance()) return this;
+ if (other.hasInstanceIdentifierPathArguments()) {
+ mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments());
+ }
+ if (other.hasNormalizedNode()) {
+ mergeNormalizedNode(other.getNormalizedNode());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasInstanceIdentifierPathArguments()) {
+
+ return false;
+ }
+ if (!hasNormalizedNode()) {
+
+ return false;
+ }
+ if (!getInstanceIdentifierPathArguments().isInitialized()) {
+
+ return false;
+ }
+ if (!getNormalizedNode().isInitialized()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData) e.getUnfinishedMessage();
+ throw e;
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+ private int bitField0_;
+
+ // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_;
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder setInstanceIdentifierPathArguments(
- int index, java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.set(index, value);
- onChanged();
+ public boolean hasInstanceIdentifierPathArguments() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ return instanceIdentifierPathArguments_;
+ } else {
+ return instanceIdentifierPathArgumentsBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierPathArguments_ = value;
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000001;
return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder addInstanceIdentifierPathArguments(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.add(value);
- onChanged();
+ public Builder setInstanceIdentifierPathArguments(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = builderForValue.build();
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder addAllInstanceIdentifierPathArguments(
- java.lang.Iterable<java.lang.String> values) {
- ensureInstanceIdentifierPathArgumentsIsMutable();
- super.addAll(values, instanceIdentifierPathArguments_);
- onChanged();
+ public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierPathArguments_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial();
+ } else {
+ instanceIdentifierPathArguments_ = value;
+ }
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
public Builder clearInstanceIdentifierPathArguments() {
- instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ onChanged();
+ } else {
+ instanceIdentifierPathArgumentsBuilder_.clear();
+ }
bitField0_ = (bitField0_ & ~0x00000001);
- onChanged();
return this;
}
/**
- * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
- public Builder addInstanceIdentifierPathArgumentsBytes(
- com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureInstanceIdentifierPathArgumentsIsMutable();
- instanceIdentifierPathArguments_.add(value);
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() {
+ bitField0_ |= 0x00000001;
onChanged();
- return this;
+ return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+ if (instanceIdentifierPathArgumentsBuilder_ != null) {
+ return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder();
+ } else {
+ return instanceIdentifierPathArguments_;
+ }
+ }
+ /**
+ * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierPathArgumentsFieldBuilder() {
+ if (instanceIdentifierPathArgumentsBuilder_ == null) {
+ instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierPathArguments_,
+ getParentForChildren(),
+ isClean());
+ instanceIdentifierPathArguments_ = null;
+ }
+ return instanceIdentifierPathArgumentsBuilder_;
}
- // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;
- private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder> normalizedNodeBuilder_;
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
public boolean hasNormalizedNode() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
if (normalizedNodeBuilder_ == null) {
return normalizedNode_;
} else {
}
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+ public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
if (normalizedNodeBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
public Builder setNormalizedNode(
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
if (normalizedNodeBuilder_ == null) {
normalizedNode_ = builderForValue.build();
onChanged();
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+ public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
if (normalizedNodeBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
- normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance()) {
+ normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
normalizedNode_ =
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
} else {
normalizedNode_ = value;
}
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
public Builder clearNormalizedNode() {
if (normalizedNodeBuilder_ == null) {
- normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+ normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
onChanged();
} else {
normalizedNodeBuilder_.clear();
return this;
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeBuilder() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
bitField0_ |= 0x00000002;
onChanged();
return getNormalizedNodeFieldBuilder().getBuilder();
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
- public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
if (normalizedNodeBuilder_ != null) {
return normalizedNodeBuilder_.getMessageOrBuilder();
} else {
}
}
/**
- * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+ * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getNormalizedNodeFieldBuilder() {
if (normalizedNodeBuilder_ == null) {
normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
normalizedNode_,
getParentForChildren(),
isClean());
return normalizedNodeBuilder_;
}
- // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.WriteData)
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.MergeData)
}
static {
- defaultInstance = new WriteData(true);
+ defaultInstance = new MergeData(true);
defaultInstance.initFields();
}
- // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.WriteData)
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.MergeData)
}
- public interface WriteDataReplyOrBuilder
+ public interface MergeDataReplyOrBuilder
extends com.google.protobuf.MessageOrBuilder {
}
/**
- * Protobuf type {@code org.opendaylight.controller.mdsal.WriteDataReply}
+ * Protobuf type {@code org.opendaylight.controller.mdsal.MergeDataReply}
*/
- public static final class WriteDataReply extends
+ public static final class MergeDataReply extends
com.google.protobuf.GeneratedMessage
- implements WriteDataReplyOrBuilder {
- // Use WriteDataReply.newBuilder() to construct.
- private WriteDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+ implements MergeDataReplyOrBuilder {
+ // Use MergeDataReply.newBuilder() to construct.
+ private MergeDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
- private WriteDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+ private MergeDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
- private static final WriteDataReply defaultInstance;
- public static WriteDataReply getDefaultInstance() {
+ private static final MergeDataReply defaultInstance;
+ public static MergeDataReply getDefaultInstance() {
return defaultInstance;
}
- public WriteDataReply getDefaultInstanceForType() {
+ public MergeDataReply getDefaultInstanceForType() {
return defaultInstance;
}
getUnknownFields() {
return this.unknownFields;
}
- private WriteDataReply(
+ private MergeDataReply(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
- return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
- return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
- org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.Builder.class);
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.Builder.class);
}
- public static com.google.protobuf.Parser<WriteDataReply> PARSER =
- new com.google.protobuf.AbstractParser<WriteDataReply>() {
- public WriteDataReply parsePartialFrom(
+ public static com.google.protobuf.Parser<MergeDataReply> PARSER =
+ new com.google.protobuf.AbstractParser<MergeDataReply>() {
+ public MergeDataReply parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- return new WriteDataReply(input, extensionRegistry);
+ return new MergeDataReply(input, extensionRegistry);
}
};
@java.lang.Override
- public com.google.protobuf.Parser<WriteDataReply> getParserForType() {
+ public com.google.protobuf.Parser<MergeDataReply> getParserForType() {
return PARSER;
}
return super.writeReplace();
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(byte[] data)
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(java.io.InputStream input)
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseDelimitedFrom(java.io.InputStream input)
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseDelimitedFrom(
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
- public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+ public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply prototype) {
+ public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
return builder;
}
/**
- * Protobuf type {@code org.opendaylight.controller.mdsal.WriteDataReply}
+ * Protobuf type {@code org.opendaylight.controller.mdsal.MergeDataReply}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
- implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReplyOrBuilder {
+ implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReplyOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
- return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
- return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
- org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.Builder.class);
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.Builder.class);
}
- // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.newBuilder()
+ // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
- return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply getDefaultInstanceForType() {
- return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.getDefaultInstance();
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply getDefaultInstanceForType() {
+ return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply build() {
- org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply result = buildPartial();
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply build() {
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
- public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply buildPartial() {
- org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply(this);
+ public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply buildPartial() {
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply(this);
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
- if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply) {
- return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply)other);
+ if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply) {
+ return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply)other);
} else {
super.mergeFrom(other);
return this;
}
}
- public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply other) {
- if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.getDefaultInstance()) return this;
+ public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply other) {
+ if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.getDefaultInstance()) return this;
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parsedMessage = null;
+ org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply) e.getUnfinishedMessage();
+ parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
return this;
}
- // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.WriteDataReply)
+ // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.MergeDataReply)
}
static {
- defaultInstance = new WriteDataReply(true);
+ defaultInstance = new MergeDataReply(true);
defaultInstance.initFields();
}
- // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.WriteDataReply)
+ // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.MergeDataReply)
}
private static com.google.protobuf.Descriptors.Descriptor
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_MergeData_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_opendaylight_controller_mdsal_MergeDataReply_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
static {
java.lang.String[] descriptorData = {
"\n\026ShardTransaction.proto\022!org.opendaylig" +
- "ht.controller.mdsal\032\032SimpleNormalizedNod" +
- "e.proto\"\022\n\020CloseTransaction\"\027\n\025CloseTran" +
- "sactionReply\"\023\n\021CreateTransaction\"1\n\026Cre" +
- "ateTransactionReply\022\027\n\017transactionPath\030\001" +
- " \002(\t\"\022\n\020ReadyTransaction\"*\n\025ReadyTransac" +
- "tionReply\022\021\n\tactorPath\030\001 \002(\t\"5\n\nDeleteDa" +
- "ta\022\'\n\037instanceIdentifierPathArguments\030\001 " +
- "\003(\t\"\021\n\017DeleteDataReply\"3\n\010ReadData\022\'\n\037in" +
- "stanceIdentifierPathArguments\030\001 \002(\t\"]\n\rR",
- "eadDataReply\022L\n\016normalizedNode\030\001 \002(\01324.o" +
- "rg.opendaylight.controller.mdsal.Normali" +
- "zedNodeXml\"\202\001\n\tWriteData\022\'\n\037instanceIden" +
- "tifierPathArguments\030\001 \003(\t\022L\n\016normalizedN" +
- "ode\030\002 \002(\01324.org.opendaylight.controller." +
- "mdsal.NormalizedNodeXml\"\020\n\016WriteDataRepl" +
- "yBV\n:org.opendaylight.controller.protobu" +
- "ff.messages.transactionB\030ShardTransactio" +
- "nMessages"
+ "ht.controller.mdsal\032\014Common.proto\"\022\n\020Clo" +
+ "seTransaction\"\027\n\025CloseTransactionReply\"*" +
+ "\n\021CreateTransaction\022\025\n\rtransactionId\030\001 \002" +
+ "(\t\"M\n\026CreateTransactionReply\022\034\n\024transact" +
+ "ionActorPath\030\001 \002(\t\022\025\n\rtransactionId\030\002 \002(" +
+ "\t\"\022\n\020ReadyTransaction\"*\n\025ReadyTransactio" +
+ "nReply\022\021\n\tactorPath\030\001 \002(\t\"l\n\nDeleteData\022" +
+ "^\n\037instanceIdentifierPathArguments\030\001 \002(\013" +
+ "25.org.opendaylight.controller.mdsal.Ins",
+ "tanceIdentifier\"\021\n\017DeleteDataReply\"j\n\010Re" +
+ "adData\022^\n\037instanceIdentifierPathArgument" +
+ "s\030\001 \002(\01325.org.opendaylight.controller.md" +
+ "sal.InstanceIdentifier\"P\n\rReadDataReply\022" +
+ "?\n\016normalizedNode\030\001 \001(\0132\'.org.opendaylig" +
+ "ht.controller.mdsal.Node\"\254\001\n\tWriteData\022^" +
+ "\n\037instanceIdentifierPathArguments\030\001 \002(\0132" +
+ "5.org.opendaylight.controller.mdsal.Inst" +
+ "anceIdentifier\022?\n\016normalizedNode\030\002 \002(\0132\'" +
+ ".org.opendaylight.controller.mdsal.Node\"",
+ "\020\n\016WriteDataReply\"\254\001\n\tMergeData\022^\n\037insta" +
+ "nceIdentifierPathArguments\030\001 \002(\01325.org.o" +
+ "pendaylight.controller.mdsal.InstanceIde" +
+ "ntifier\022?\n\016normalizedNode\030\002 \002(\0132\'.org.op" +
+ "endaylight.controller.mdsal.Node\"\020\n\016Merg" +
+ "eDataReplyBV\n:org.opendaylight.controlle" +
+ "r.protobuff.messages.transactionB\030ShardT" +
+ "ransactionMessages"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor,
- new java.lang.String[] { });
+ new java.lang.String[] { "TransactionId", });
internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor,
- new java.lang.String[] { "TransactionPath", });
+ new java.lang.String[] { "TransactionActorPath", "TransactionId", });
internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor =
getDescriptor().getMessageTypes().get(4);
internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor,
new java.lang.String[] { });
+ internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor =
+ getDescriptor().getMessageTypes().get(12);
+ internal_static_org_opendaylight_controller_mdsal_MergeData_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor,
+ new java.lang.String[] { "InstanceIdentifierPathArguments", "NormalizedNode", });
+ internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor =
+ getDescriptor().getMessageTypes().get(13);
+ internal_static_org_opendaylight_controller_mdsal_MergeDataReply_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor,
+ new java.lang.String[] { });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
- org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.getDescriptor(),
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
}, assigner);
}
--- /dev/null
+package org.opendaylight.controller.mdsal;
+
+option java_package = "org.opendaylight.controller.protobuff.messages.cohort3pc";
+option java_outer_classname = "ThreePhaseCommitCohortMessages";
+
+
+message CanCommitTransaction{
+
+}
+
+message CanCommitTransactionReply{
+ required bool canCommit = 1;
+
+}
+
+message AbortTransaction{
+
+}
+
+message AbortTransactionReply {
+
+}
+
+message CommitTransaction{
+
+}
+
+message CommitTransactionReply{
+
+}
+
+message PreCommitTransaction{
+
+}
+message PreCommitTransactionReply{
+
+}
\ No newline at end of file
--- /dev/null
+package org.opendaylight.controller.mdsal;
+
+option java_package = "org.opendaylight.controller.protobuff.messages.common";
+option java_outer_classname = "NormalizedNodeMessages";
+
+
+message Attribute{
+ required string name =1;
+ optional string value=2;
+ optional string type=3;
+}
+
+message QName {
+ required string value=1;
+}
+
+message PathArgument {
+ required string value=1;
+ optional string type=2; //NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+ optional QName nodeType=3;
+ repeated Attribute attributes=4;
+
+}
+
+message InstanceIdentifier {
+ repeated PathArgument arguments=1;
+}
+
+message Node{
+ optional string path = 1;
+ optional string type = 2;
+ repeated Attribute attributes = 3;
+ repeated Node child=4;
+ optional string value = 5;
+ optional string valueType = 6;
+ repeated string bitsValue = 7;
+ optional InstanceIdentifier instanceIdentifierValue = 8;
+}
+
+message Container{
+ required string parentPath =1 ;
+ optional Node normalizedNode=2;
+}
+
+message NodeMapEntry{
+ required InstanceIdentifier instanceIdentifierPath =1;
+ optional Node normalizedNode=2;
+}
+
+message NodeMap{
+repeated NodeMapEntry mapEntries=1;
+}
--- /dev/null
+package org.opendaylight.controller.mdsal;
+
+import "AppendEntriesMessages.proto";
+import "Common.proto";
+import "Persistent.proto";
+
+extend org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload {
+ optional CompositeModification modification=2;
+}
+
+
package org.opendaylight.controller.mdsal;
-import "SimpleNormalizedNode.proto";
+import "Common.proto";
option java_package = "org.opendaylight.controller.protobuff.messages.datachange.notification";
option java_outer_classname = "DataChangeListenerMessages";
-message DataChanged{
- repeated string instanceIdentifierPathArguments =1 ;
- required NormalizedNodeXml normalizedNodeXml = 2;
+message DataChanged {
+ optional Node originalSubTree = 1;
+ optional Node updatedSubTree = 2;
+ optional NodeMap originalData =3;
+ optional NodeMap updatedData =4;
+ optional NodeMap createdData =5;
+ repeated InstanceIdentifier removedPaths =6;
}
+
message DataChangedReply{
-}
\ No newline at end of file
+}
package org.opendaylight.controller.mdsal;
+import "Common.proto";
+
option java_package = "org.opendaylight.controller.protobuff.messages.registration";
option java_outer_classname = "ListenerRegistrationMessages";
-message Close {
+/** used when a listener needs to be unregistered*/
+message CloseDataChangeListenerRegistration {
+
+}
+/** reply to the CloseDataChangeListenerRegistration request*/
+message CloseDataChangeListenerRegistrationReply{
}
-message CloseReply{
+/**
+ * When registering a listener at particular level of tree
+ * identified by instanceIdentifierPath.
+ * dataChangeListenerActorPath is path to actor that will
+ * receive the change event
+ * scope is the data change scope like BASE,ONE and SUBTREE
+ * defined in AsyncDataBroker.DataChangeScope
+ */
+
+message RegisterChangeListener{
+required InstanceIdentifier instanceIdentifierPath=1;
+required string dataChangeListenerActorPath=2;
+required int32 dataChangeScope=3;
+}
+/**
+* This is the reply for the RegisterChangeListener message
+* It contains the listenerRegistration actor path
+* that can be used to unregister the listener
+*/
+message RegisterChangeListenerReply{
+required string listenerRegistrationPath=1;
}
--- /dev/null
+package org.opendaylight.controller.mdsal;
+
+import "Common.proto";
+import "AppendEntriesMessages.proto";
+
+option java_package = "org.opendaylight.controller.protobuff.messages.persistent";
+option java_outer_classname = "PersistentMessages";
+
+
+message Modification {
+ required string type=1;
+ required InstanceIdentifier path=2;
+ optional Node data=3;
+}
+
+
+message CompositeModification {
+ repeated Modification modification=1;
+}
+
}
message PrimaryFound {
+ required string primaryPath =1;
}
message PrimaryNotFound {
+ required string shardName =1;
}
package org.opendaylight.controller.mdsal;
-import "SimpleNormalizedNode.proto";
+
+import "Common.proto";
+
option java_package = "org.opendaylight.controller.protobuff.messages.transaction";
option java_outer_classname = "ShardTransactionMessages";
}
message CreateTransaction{
-
+ required string transactionId = 1;
}
message CreateTransactionReply{
-required string transactionPath = 1;
+required string transactionActorPath = 1;
+required string transactionId = 2;
}
}
message DeleteData {
-repeated string instanceIdentifierPathArguments = 1;
+required InstanceIdentifier instanceIdentifierPathArguments = 1;
}
message DeleteDataReply{
}
message ReadData {
-required string instanceIdentifierPathArguments=1;
+required InstanceIdentifier instanceIdentifierPathArguments=1;
}
message ReadDataReply{
- required NormalizedNodeXml normalizedNode=1;
+ optional Node normalizedNode=1;
}
message WriteData {
- repeated string instanceIdentifierPathArguments = 1;
-required NormalizedNodeXml normalizedNode =2;
+ required InstanceIdentifier instanceIdentifierPathArguments = 1;
+required Node normalizedNode =2;
}
message WriteDataReply{
-}
\ No newline at end of file
+}
+
+message MergeData {
+ required InstanceIdentifier instanceIdentifierPathArguments = 1;
+required Node normalizedNode =2;
+
+}
+
+message MergeDataReply{
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.node;
+
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeGetter;
+import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeNavigator;
+import org.opendaylight.controller.cluster.datastore.util.TestModel;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+public class NormalizedNodeToNodeCodecTest {
+
+
+
+ private SchemaContext schemaContext;
+
+ @Before
+ public void setUp(){
+ schemaContext = TestModel.createTestContext();
+ assertNotNull("Schema context must not be null.", schemaContext);
+ }
+
+ private YangInstanceIdentifier instanceIdentifierFromString(String s){
+
+ String[] ids = s.split("/");
+
+ List<YangInstanceIdentifier.PathArgument> pathArguments = new ArrayList<>();
+ for(String nodeId : ids){
+ if(!"".equals(nodeId)) {
+ pathArguments.add(NodeIdentifierFactory.getArgument(nodeId));
+ }
+ }
+ final YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier.create(pathArguments);
+ return instanceIdentifier;
+ }
+
+
+ @Test
+ public void testNormalizeNodeAttributesToProtoBuffNode(){
+ final NormalizedNode<?, ?> documentOne = TestModel.createTestContainer();
+ String id = "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test" +
+ "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list" +
+ "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=2}]" +
+ "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id";
+
+ NormalizedNodeGetter normalizedNodeGetter = new NormalizedNodeGetter(id);
+ new NormalizedNodeNavigator(normalizedNodeGetter).navigate(
+ YangInstanceIdentifier.builder().build().toString(), documentOne);
+
+ // Validate the value of id can be retrieved from the normalized node
+ NormalizedNode output = normalizedNodeGetter.getOutput();
+ assertNotNull(output);
+
+
+ NormalizedNodeToNodeCodec codec = new NormalizedNodeToNodeCodec(schemaContext);
+ Container container = codec.encode(instanceIdentifierFromString(id),output);
+
+ assertNotNull(container);
+ assertEquals(id, container.getParentPath()+"/"+container.getNormalizedNode().getPath()) ;
+
+ // Decode the normalized node from the ProtocolBuffer form
+ //first get the node representation of normalized node
+ final Node node = container.getNormalizedNode();
+
+ NormalizedNode<?,?> normalizedNode = codec.decode(instanceIdentifierFromString(id),node);
+
+ assertEquals(normalizedNode.getValue().toString(),output.getValue().toString());
+ }
+
+ @Test
+ public void testThatANormalizedNodeToProtoBuffNodeEncodeDecode() throws Exception {
+ final NormalizedNode<?, ?> documentOne = TestModel.createTestContainer();
+
+ final NormalizedNodeToNodeCodec normalizedNodeToNodeCodec = new NormalizedNodeToNodeCodec(schemaContext);
+
+ Container container = normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder().build(), documentOne);
+
+
+ final NormalizedNode<?, ?> decode = normalizedNodeToNodeCodec.decode(instanceIdentifierFromString("/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"),container.getNormalizedNode());
+ assertNotNull(decode != null);
+
+ //let us ensure that the return decode normalized node encode returns same container
+ Container containerResult = normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder().build(), decode);
+
+ assertEquals(container.getParentPath(),containerResult.getParentPath());
+ assertEquals(container.getNormalizedNode().getChildCount(),container.getNormalizedNode().getChildCount());
+
+ Assert.assertEquals(containerResult.getNormalizedNode().getChildCount(),container.getNormalizedNode().getChildCount());
+
+ //check first level children are proper
+ List<Node>childrenResult = containerResult.getNormalizedNode().getChildList();
+ List<Node>childrenOriginal = container.getNormalizedNode().getChildList();
+
+ System.out.println("-------------------------------------------------");
+
+ System.out.println(childrenOriginal.toString());
+
+ System.out.println("-------------------------------------------------");
+
+ System.out.println(childrenResult.toString());
+
+ boolean bFound;
+ for(Node resultChild: childrenResult){
+ bFound = false;
+ for(Node originalChild:childrenOriginal){
+ if(originalChild.getPath().equals(resultChild.getPath())
+ && resultChild.getType().equals(resultChild.getType())){
+ bFound=true;
+ break;
+ }
+ }
+ Assert.assertTrue(bFound);
+ }
+
+ }
+
+ @Test
+ public void addAugmentations(){
+ String stringId = "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test" +
+ "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)augmented-list" +
+ "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)augmented-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=1}]";
+
+ YangInstanceIdentifier identifier = instanceIdentifierFromString(stringId);
+
+ MapEntryNode uno = TestModel.createAugmentedListEntry(1, "Uno");
+
+ NormalizedNodeToNodeCodec codec =
+ new NormalizedNodeToNodeCodec(schemaContext);
+
+ Container encode = codec
+ .encode(identifier, uno);
+
+ System.out.println(encode.getNormalizedNode());
+
+ codec.decode(identifier, encode.getNormalizedNode());
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class NodeIdentifierFactoryTest {
+
+ @Test
+ public void validateAugmentationIdentifier(){
+ YangInstanceIdentifier.PathArgument argument = NodeIdentifierFactory
+ .getArgument(
+ "AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}");
+
+ Assert.assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier);
+
+
+ }
+
+}
--- /dev/null
+package org.opendaylight.controller.cluster.datastore.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+public class InstanceIdentifierUtilsTest {
+
+ private static QName TEST_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test");
+ private static QName NODE_WITH_VALUE_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)value");
+ private static QName NODE_WITH_PREDICATES_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred");
+ private static QName NAME_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name");
+
+ @Test
+ public void testSerializationOfNodeIdentifier(){
+ YangInstanceIdentifier.PathArgument p1 =
+ new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+
+ List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+
+ arguments.add(p1);
+
+ YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(expected);
+
+ YangInstanceIdentifier actual =
+ InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+
+
+ Assert.assertEquals(expected.getLastPathArgument(),
+ actual.getLastPathArgument());
+
+
+ }
+
+ @Test
+ public void testSerializationOfNodeWithValue(){
+
+ withValue((short) 1);
+ withValue((long) 2);
+ withValue(3);
+ withValue(true);
+
+ }
+
+ private void withValue(Object value){
+ YangInstanceIdentifier.PathArgument p1 =
+ new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+
+ YangInstanceIdentifier.PathArgument p2 =
+ new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value);
+
+
+ List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+
+ arguments.add(p1);
+ arguments.add(p2);
+
+ YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(expected);
+
+ YangInstanceIdentifier actual =
+ InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+
+
+ Assert.assertEquals(expected.getLastPathArgument(),
+ actual.getLastPathArgument());
+ }
+
+
+ @Test
+ public void testSerializationOfNodeIdentifierWithPredicates(){
+
+ withPredicates((short) 1);
+ withPredicates((long) 2);
+ withPredicates(3);
+ withPredicates(true);
+
+ }
+
+ private void withPredicates(Object value){
+ YangInstanceIdentifier.PathArgument p1 =
+ new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+
+ YangInstanceIdentifier.PathArgument p2 =
+ new YangInstanceIdentifier.NodeIdentifierWithPredicates(NODE_WITH_PREDICATES_QNAME, NAME_QNAME, value);
+
+
+ List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+
+ arguments.add(p1);
+ arguments.add(p2);
+
+ YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(expected);
+
+ YangInstanceIdentifier actual =
+ InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+
+
+ Assert.assertEquals(expected.getLastPathArgument(),
+ actual.getLastPathArgument());
+ }
+
+ @Test
+ public void testAugmentationIdentifier(){
+ YangInstanceIdentifier.PathArgument p1 =
+ new YangInstanceIdentifier.AugmentationIdentifier(new HashSet(Arrays.asList(TEST_QNAME)));
+
+ List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+
+ arguments.add(p1);
+
+ YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(expected);
+
+ YangInstanceIdentifier actual =
+ InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+
+
+ Assert.assertEquals(expected.getLastPathArgument(),
+ actual.getLastPathArgument());
+
+ }
+
+}
*/
package org.opendaylight.controller.cluster.datastore.util;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URI;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.URI;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
public class NormalizedNodeXmlConverterTest {
- private static final Logger logger = LoggerFactory
- .getLogger(NormalizedNodeXmlConverterTest.class);
- public static final String NAMESPACE =
- "urn:opendaylight:params:xml:ns:yang:controller:test";
- private static Date revision;
- private ContainerNode expectedNode;
- private ContainerSchemaNode containerNode;
- private String xmlPath;
-
- static {
- try {
- revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-13");
- } catch (ParseException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static DataSchemaNode getSchemaNode(final SchemaContext context,
- final String moduleName, final String childNodeName) {
- for (Module module : context.getModules()) {
- if (module.getName().equals(moduleName)) {
- DataSchemaNode found =
- findChildNode(module.getChildNodes(), childNodeName);
- Preconditions.checkState(found != null, "Unable to find %s",
- childNodeName);
- return found;
- }
+ private static final Logger logger = LoggerFactory
+ .getLogger(NormalizedNodeXmlConverterTest.class);
+ public static final String NAMESPACE =
+ "urn:opendaylight:params:xml:ns:yang:controller:test";
+ private static Date revision;
+ private ContainerNode expectedNode;
+ private ContainerSchemaNode containerNode;
+ private String xmlPath;
+
+ static {
+ try {
+ revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-13");
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
}
- throw new IllegalStateException("Unable to find child node "
- + childNodeName);
- }
- static DataSchemaNode findChildNode(final Iterable<DataSchemaNode> children, final String name) {
- List<DataNodeContainer> containers = Lists.newArrayList();
+ public static DataSchemaNode getSchemaNode(final SchemaContext context,
+ final String moduleName, final String childNodeName) {
+ for (Module module : context.getModules()) {
+ if (module.getName().equals(moduleName)) {
+ DataSchemaNode found =
+ findChildNode(module.getChildNodes(), childNodeName);
+ Preconditions.checkState(found != null, "Unable to find %s",
+ childNodeName);
+ return found;
+ }
+ }
+ throw new IllegalStateException("Unable to find child node "
+ + childNodeName);
+ }
- for (DataSchemaNode dataSchemaNode : children) {
- if (dataSchemaNode.getQName().getLocalName().equals(name)) {
- return dataSchemaNode;
+ static DataSchemaNode findChildNode(final Collection<DataSchemaNode> children, final String name) {
+ List<DataNodeContainer> containers = Lists.newArrayList();
+
+ for (DataSchemaNode dataSchemaNode : children) {
+ if (dataSchemaNode.getQName().getLocalName().equals(name)) {
+ return dataSchemaNode;
+ }
+ if (dataSchemaNode instanceof DataNodeContainer) {
+ containers.add((DataNodeContainer) dataSchemaNode);
+ } else if (dataSchemaNode instanceof ChoiceNode) {
+ containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
+ }
+ }
+
+ for (DataNodeContainer container : containers) {
+ DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
+ if (retVal != null) {
+ return retVal;
+ }
+ }
+
+ return null;
}
- if (dataSchemaNode instanceof DataNodeContainer) {
- containers.add((DataNodeContainer) dataSchemaNode);
- } else if (dataSchemaNode instanceof ChoiceNode) {
- containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
- }
+
+ public static YangInstanceIdentifier.NodeIdentifier getNodeIdentifier(
+ final String localName) {
+ return new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ URI.create(NAMESPACE), revision, localName));
}
- for (DataNodeContainer container : containers) {
- DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
- if (retVal != null) {
- return retVal;
- }
+ public static YangInstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(
+ final String... childNames) {
+ Set<QName> qn = Sets.newHashSet();
+
+ for (String childName : childNames) {
+ qn.add(getNodeIdentifier(childName).getNodeType());
+ }
+
+ return new YangInstanceIdentifier.AugmentationIdentifier(qn);
}
- return null;
- }
- private static InstanceIdentifier.NodeIdentifier getNodeIdentifier(
- final String localName) {
- return new InstanceIdentifier.NodeIdentifier(QName.create(
- URI.create(NAMESPACE), revision, localName));
- }
+ public static ContainerNode augmentChoiceExpectedNode() {
+
+ DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b =
+ Builders.containerBuilder();
+ b.withNodeIdentifier(getNodeIdentifier("container"));
+
+ b.withChild(Builders
+ .choiceBuilder()
+ .withNodeIdentifier(getNodeIdentifier("ch2"))
+ .withChild(
+ Builders.leafBuilder()
+ .withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2")
+ .build())
+ .withChild(
+ Builders
+ .choiceBuilder()
+ .withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
+ .withChild(
+ Builders
+ .leafBuilder()
+ .withNodeIdentifier(
+ getNodeIdentifier("c2DeepChoiceCase1Leaf2"))
+ .withValue("2").build()).build()).build());
+
+ b.withChild(Builders
+ .choiceBuilder()
+ .withNodeIdentifier(getNodeIdentifier("ch3"))
+ .withChild(
+ Builders.leafBuilder()
+ .withNodeIdentifier(getNodeIdentifier("c3Leaf")).withValue("3")
+ .build()).build());
+
+ b.withChild(Builders
+ .augmentationBuilder()
+ .withNodeIdentifier(getAugmentIdentifier("augLeaf"))
+ .withChild(
+ Builders.leafBuilder()
+ .withNodeIdentifier(getNodeIdentifier("augLeaf"))
+ .withValue("augment").build()).build());
+
+ b.withChild(Builders
+ .augmentationBuilder()
+ .withNodeIdentifier(getAugmentIdentifier("ch"))
+ .withChild(
+ Builders
+ .choiceBuilder()
+ .withNodeIdentifier(getNodeIdentifier("ch"))
+ .withChild(
+ Builders.leafBuilder()
+ .withNodeIdentifier(getNodeIdentifier("c1Leaf"))
+ .withValue("1").build())
+ .withChild(
+ Builders
+ .augmentationBuilder()
+ .withNodeIdentifier(
+ getAugmentIdentifier("c1Leaf_AnotherAugment",
+ "deepChoice"))
+ .withChild(
+ Builders
+ .leafBuilder()
+ .withNodeIdentifier(
+ getNodeIdentifier("c1Leaf_AnotherAugment"))
+ .withValue("1").build())
+ .withChild(
+ Builders
+ .choiceBuilder()
+ .withNodeIdentifier(
+ getNodeIdentifier("deepChoice"))
+ .withChild(
+ Builders
+ .leafBuilder()
+ .withNodeIdentifier(
+ getNodeIdentifier("deepLeafc1"))
+ .withValue("1").build()).build())
+ .build()).build()).build());
+
+ return b.build();
+ }
- public static InstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(
- final String... childNames) {
- Set<QName> qn = Sets.newHashSet();
- for (String childName : childNames) {
- qn.add(getNodeIdentifier(childName).getNodeType());
+
+ public void init(final String yangPath, final String xmlPath, final ContainerNode expectedNode)
+ throws Exception {
+ SchemaContext schema = parseTestSchema(yangPath);
+ this.xmlPath = xmlPath;
+ this.containerNode =
+ (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
+ this.expectedNode = expectedNode;
}
- return new InstanceIdentifier.AugmentationIdentifier(qn);
- }
-
-
- private static ContainerNode augmentChoiceExpectedNode() {
-
- DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifier, ContainerNode> b =
- Builders.containerBuilder();
- b.withNodeIdentifier(getNodeIdentifier("container"));
-
- b.withChild(Builders
- .choiceBuilder()
- .withNodeIdentifier(getNodeIdentifier("ch2"))
- .withChild(
- Builders.leafBuilder()
- .withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2")
- .build())
- .withChild(
- Builders
- .choiceBuilder()
- .withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
- .withChild(
- Builders
- .leafBuilder()
- .withNodeIdentifier(
- getNodeIdentifier("c2DeepChoiceCase1Leaf2"))
- .withValue("2").build()).build()).build());
-
- b.withChild(Builders
- .choiceBuilder()
- .withNodeIdentifier(getNodeIdentifier("ch3"))
- .withChild(
- Builders.leafBuilder()
- .withNodeIdentifier(getNodeIdentifier("c3Leaf")).withValue("3")
- .build()).build());
-
- b.withChild(Builders
- .augmentationBuilder()
- .withNodeIdentifier(getAugmentIdentifier("augLeaf"))
- .withChild(
- Builders.leafBuilder()
- .withNodeIdentifier(getNodeIdentifier("augLeaf"))
- .withValue("augment").build()).build());
-
- b.withChild(Builders
- .augmentationBuilder()
- .withNodeIdentifier(getAugmentIdentifier("ch"))
- .withChild(
- Builders
- .choiceBuilder()
- .withNodeIdentifier(getNodeIdentifier("ch"))
- .withChild(
- Builders.leafBuilder()
- .withNodeIdentifier(getNodeIdentifier("c1Leaf"))
- .withValue("1").build())
- .withChild(
- Builders
- .augmentationBuilder()
- .withNodeIdentifier(
- getAugmentIdentifier("c1Leaf_AnotherAugment",
- "deepChoice"))
- .withChild(
- Builders
- .leafBuilder()
- .withNodeIdentifier(
- getNodeIdentifier("c1Leaf_AnotherAugment"))
- .withValue("1").build())
- .withChild(
- Builders
- .choiceBuilder()
- .withNodeIdentifier(
- getNodeIdentifier("deepChoice"))
- .withChild(
- Builders
- .leafBuilder()
- .withNodeIdentifier(
- getNodeIdentifier("deepLeafc1"))
- .withValue("1").build()).build())
- .build()).build()).build());
-
- return b.build();
- }
-
-
-
- public void init(final String yangPath, final String xmlPath, final ContainerNode expectedNode)
- throws Exception {
- SchemaContext schema = parseTestSchema(yangPath);
- this.xmlPath = xmlPath;
- this.containerNode =
- (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
- this.expectedNode = expectedNode;
- }
-
- SchemaContext parseTestSchema(final String yangPath) throws Exception {
-
- YangParserImpl yangParserImpl = new YangParserImpl();
- InputStream stream =
- NormalizedNodeXmlConverterTest.class.getResourceAsStream(yangPath);
- ArrayList<InputStream> al = new ArrayList<InputStream>();
- al.add(stream);
- Set<Module> modules = yangParserImpl.parseYangModelsFromStreams(al);
- return yangParserImpl.resolveSchemaContext(modules);
-
- }
-
-
- @Test
- public void testConversionWithAugmentChoice() throws Exception {
- init("/augment_choice.yang", "/augment_choice.xml",
- augmentChoiceExpectedNode());
- Document doc = loadDocument(xmlPath);
-
- ContainerNode built =
- DomToNormalizedNodeParserFactory
- .getInstance(DomUtils.defaultValueCodecProvider())
- .getContainerNodeParser()
- .parse(Collections.singletonList(doc.getDocumentElement()),
- containerNode);
-
- if (expectedNode != null) {
- junit.framework.Assert.assertEquals(expectedNode, built);
+ SchemaContext parseTestSchema(final String yangPath) throws Exception {
+
+ YangParserImpl yangParserImpl = new YangParserImpl();
+ InputStream stream =
+ NormalizedNodeXmlConverterTest.class.getResourceAsStream(yangPath);
+ ArrayList<InputStream> al = new ArrayList<InputStream>();
+ al.add(stream);
+ Set<Module> modules = yangParserImpl.parseYangModelsFromStreams(al);
+ return yangParserImpl.resolveSchemaContext(modules);
+
}
- logger.info("{}", built);
- Iterable<Element> els =
- DomFromNormalizedNodeSerializerFactory
- .getInstance(XmlDocumentUtils.getDocument(),
- DomUtils.defaultValueCodecProvider())
- .getContainerNodeSerializer().serialize(containerNode, built);
+ @Test
+ public void testConversionWithAugmentChoice() throws Exception {
+ init("/augment_choice.yang", "/augment_choice.xml",
+ augmentChoiceExpectedNode());
+ Document doc = loadDocument(xmlPath);
- Element el = els.iterator().next();
+ ContainerNode built =
+ DomToNormalizedNodeParserFactory
+ .getInstance(DomUtils.defaultValueCodecProvider())
+ .getContainerNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ containerNode);
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreComments(true);
+ if (expectedNode != null) {
+ junit.framework.Assert.assertEquals(expectedNode, built);
+ }
- System.out.println(toString(doc.getDocumentElement()));
- System.out.println(toString(el));
+ logger.info("{}", built);
- new Diff(
- XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
- XMLUnit.buildTestDocument(toString(el))).similar();
- }
+ Iterable<Element> els =
+ DomFromNormalizedNodeSerializerFactory
+ .getInstance(XmlDocumentUtils.getDocument(),
+ DomUtils.defaultValueCodecProvider())
+ .getContainerNodeSerializer().serialize(containerNode, built);
- private static ContainerNode listLeafListWithAttributes() {
- DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifier, ContainerNode> b =
- Builders.containerBuilder();
- b.withNodeIdentifier(getNodeIdentifier("container"));
+ Element el = els.iterator().next();
- CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder =
- Builders.mapBuilder().withNodeIdentifier(getNodeIdentifier("list"));
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreComments(true);
- Map<QName, Object> predicates = Maps.newHashMap();
- predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
+ System.out.println(toString(doc.getDocumentElement()));
+ System.out.println(toString(el));
- DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> list1Builder =
- Builders.mapEntryBuilder().withNodeIdentifier(
- new InstanceIdentifier.NodeIdentifierWithPredicates(
- getNodeIdentifier("list").getNodeType(), predicates));
- NormalizedNodeBuilder<InstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> uint32InListBuilder =
- Builders.leafBuilder().withNodeIdentifier(
- getNodeIdentifier("uint32InList"));
+ new Diff(
+ XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+ XMLUnit.buildTestDocument(toString(el))).similar();
+ }
- list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
+ private static ContainerNode listLeafListWithAttributes() {
+ DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b =
+ Builders.containerBuilder();
+ b.withNodeIdentifier(getNodeIdentifier("container"));
- listBuilder.withChild(list1Builder.build());
- b.withChild(listBuilder.build());
+ CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder =
+ Builders.mapBuilder().withNodeIdentifier(getNodeIdentifier("list"));
- NormalizedNodeBuilder<InstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder =
- Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
- booleanBuilder.withValue(false);
- b.withChild(booleanBuilder.build());
+ Map<QName, Object> predicates = Maps.newHashMap();
+ predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
- ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder =
- Builders.leafSetBuilder().withNodeIdentifier(
- getNodeIdentifier("leafList"));
+ DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> list1Builder =
+ Builders.mapEntryBuilder().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+ getNodeIdentifier("list").getNodeType(), predicates));
+ NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> uint32InListBuilder =
+ Builders.leafBuilder().withNodeIdentifier(
+ getNodeIdentifier("uint32InList"));
- NormalizedNodeBuilder<InstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder =
- Builders.leafSetEntryBuilder().withNodeIdentifier(
- new InstanceIdentifier.NodeWithValue(getNodeIdentifier("leafList")
- .getNodeType(), "a"));
+ list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
- leafList1Builder.withValue("a");
+ listBuilder.withChild(list1Builder.build());
+ b.withChild(listBuilder.build());
- leafListBuilder.withChild(leafList1Builder.build());
- b.withChild(leafListBuilder.build());
+ NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder =
+ Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
+ booleanBuilder.withValue(false);
+ b.withChild(booleanBuilder.build());
- return b.build();
- }
+ ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder =
+ Builders.leafSetBuilder().withNodeIdentifier(
+ getNodeIdentifier("leafList"));
+ NormalizedNodeBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder =
+ Builders.leafSetEntryBuilder().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(getNodeIdentifier("leafList")
+ .getNodeType(), "a"));
- @Test
- public void testConversionWithAttributes() throws Exception {
- init("/test.yang", "/simple_xml_with_attributes.xml",
- listLeafListWithAttributes());
- Document doc = loadDocument(xmlPath);
+ leafList1Builder.withValue("a");
- ContainerNode built =
- DomToNormalizedNodeParserFactory
- .getInstance(DomUtils.defaultValueCodecProvider())
- .getContainerNodeParser()
- .parse(Collections.singletonList(doc.getDocumentElement()),
- containerNode);
+ leafListBuilder.withChild(leafList1Builder.build());
+ b.withChild(leafListBuilder.build());
- if (expectedNode != null) {
- junit.framework.Assert.assertEquals(expectedNode, built);
+ return b.build();
}
- logger.info("{}", built);
- Iterable<Element> els =
- DomFromNormalizedNodeSerializerFactory
- .getInstance(XmlDocumentUtils.getDocument(),
- DomUtils.defaultValueCodecProvider())
- .getContainerNodeSerializer().serialize(containerNode, built);
+ @Test
+ public void testConversionWithAttributes() throws Exception {
+ init("/test.yang", "/simple_xml_with_attributes.xml",
+ listLeafListWithAttributes());
+ Document doc = loadDocument(xmlPath);
+
+ ContainerNode built =
+ DomToNormalizedNodeParserFactory
+ .getInstance(DomUtils.defaultValueCodecProvider())
+ .getContainerNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ containerNode);
- Element el = els.iterator().next();
+ if (expectedNode != null) {
+ junit.framework.Assert.assertEquals(expectedNode, built);
+ }
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreComments(true);
+ logger.info("{}", built);
- System.out.println(toString(doc.getDocumentElement()));
- System.out.println(toString(el));
+ Iterable<Element> els =
+ DomFromNormalizedNodeSerializerFactory
+ .getInstance(XmlDocumentUtils.getDocument(),
+ DomUtils.defaultValueCodecProvider())
+ .getContainerNodeSerializer().serialize(containerNode, built);
- new Diff(
- XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
- XMLUnit.buildTestDocument(toString(el))).similar();
- }
+ Element el = els.iterator().next();
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreComments(true);
- private Document loadDocument(final String xmlPath) throws Exception {
- InputStream resourceAsStream =
- NormalizedNodeXmlConverterTest.class.getResourceAsStream(xmlPath);
+ System.out.println(toString(doc.getDocumentElement()));
+ System.out.println(toString(el));
- Document currentConfigElement = readXmlToDocument(resourceAsStream);
- Preconditions.checkNotNull(currentConfigElement);
- return currentConfigElement;
- }
+ new Diff(
+ XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+ XMLUnit.buildTestDocument(toString(el))).similar();
+ }
- private static final DocumentBuilderFactory BUILDERFACTORY;
- static {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- factory.setCoalescing(true);
- factory.setIgnoringElementContentWhitespace(true);
- factory.setIgnoringComments(true);
- BUILDERFACTORY = factory;
- }
+ private Document loadDocument(final String xmlPath) throws Exception {
+ InputStream resourceAsStream =
+ NormalizedNodeXmlConverterTest.class.getResourceAsStream(xmlPath);
- private Document readXmlToDocument(final InputStream xmlContent)
- throws IOException, SAXException {
- DocumentBuilder dBuilder;
- try {
- dBuilder = BUILDERFACTORY.newDocumentBuilder();
- } catch (ParserConfigurationException e) {
- throw new RuntimeException("Failed to parse XML document", e);
+ Document currentConfigElement = readXmlToDocument(resourceAsStream);
+ Preconditions.checkNotNull(currentConfigElement);
+ return currentConfigElement;
}
- Document doc = dBuilder.parse(xmlContent);
-
- doc.getDocumentElement().normalize();
- return doc;
- }
-
- public static String toString(final Element xml) {
- try {
- Transformer transformer =
- TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
- StreamResult result = new StreamResult(new StringWriter());
- DOMSource source = new DOMSource(xml);
- transformer.transform(source, result);
-
- return result.getWriter().toString();
- } catch (IllegalArgumentException | TransformerFactoryConfigurationError
- | TransformerException e) {
- throw new RuntimeException("Unable to serialize xml element " + xml, e);
+
+ private static final DocumentBuilderFactory BUILDERFACTORY;
+
+ static {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setCoalescing(true);
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setIgnoringComments(true);
+ BUILDERFACTORY = factory;
+ }
+
+ private Document readXmlToDocument(final InputStream xmlContent)
+ throws IOException, SAXException {
+ DocumentBuilder dBuilder;
+ try {
+ dBuilder = BUILDERFACTORY.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException("Failed to parse XML document", e);
+ }
+ Document doc = dBuilder.parse(xmlContent);
+
+ doc.getDocumentElement().normalize();
+ return doc;
+ }
+
+ public static String toString(final Element xml) {
+ try {
+ Transformer transformer =
+ TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+ StreamResult result = new StreamResult(new StringWriter());
+ DOMSource source = new DOMSource(xml);
+ transformer.transform(source, result);
+
+ return result.getWriter().toString();
+ } catch (IllegalArgumentException | TransformerFactoryConfigurationError
+ | TransformerException e) {
+ throw new RuntimeException("Unable to serialize xml element " + xml, e);
+ }
+ }
+
+ @Test
+ public void testConversionToNormalizedXml() throws Exception {
+ SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
+ EncoderDecoderUtil.encode(parseTestSchema("/augment_choice.yang"),
+ augmentChoiceExpectedNode());
+ Document expectedDoc = loadDocument("/augment_choice.xml");
+ Document convertedDoc =
+ EncoderDecoderUtil.factory.newDocumentBuilder().parse(
+ new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
+ System.out.println(toString(convertedDoc.getDocumentElement()));
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreComments(true);
+ new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
+ .getDocumentElement())),
+ XMLUnit.buildTestDocument(toString(convertedDoc
+ .getDocumentElement()))).similar();
+ System.out.println(toString(expectedDoc.getDocumentElement()));
+
+ }
+
+
+ @Test
+ public void testConversionFromXmlToNormalizedNode() throws Exception {
+ SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
+ EncoderDecoderUtil.encode(parseTestSchema("/test.yang"),
+ listLeafListWithAttributes());
+ Document expectedDoc = loadDocument("/simple_xml_with_attributes.xml");
+ Document convertedDoc =
+ EncoderDecoderUtil.factory.newDocumentBuilder().parse(
+ new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
+ System.out.println(toString(convertedDoc.getDocumentElement()));
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreComments(true);
+ new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
+ .getDocumentElement())),
+ XMLUnit.buildTestDocument(toString(convertedDoc
+ .getDocumentElement()))).similar();
+ System.out.println(toString(expectedDoc.getDocumentElement()));
+
+ // now we will try to convert xml back to normalize node.
+ ContainerNode cn =
+ (ContainerNode) EncoderDecoderUtil.decode(
+ parseTestSchema("/test.yang"), nnXml);
+ junit.framework.Assert.assertEquals(listLeafListWithAttributes(), cn);
+
}
- }
- @Test
- public void testConversionToNormalizedXml() throws Exception {
- SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
- EncoderDecoderUtil.encode(parseTestSchema("/augment_choice.yang"),
- augmentChoiceExpectedNode());
- Document expectedDoc = loadDocument("/augment_choice.xml");
- Document convertedDoc =
- EncoderDecoderUtil.factory.newDocumentBuilder().parse(
- new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
- System.out.println(toString(convertedDoc.getDocumentElement()));
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreComments(true);
- new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
- .getDocumentElement())),
- XMLUnit.buildTestDocument(toString(convertedDoc
- .getDocumentElement()))).similar();
- System.out.println(toString(expectedDoc.getDocumentElement()));
-
- }
-
-
- @Test
- public void testConversionFromXmlToNormalizedNode() throws Exception {
- SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
- EncoderDecoderUtil.encode(parseTestSchema("/test.yang"),
- listLeafListWithAttributes());
- Document expectedDoc = loadDocument("/simple_xml_with_attributes.xml");
- Document convertedDoc =
- EncoderDecoderUtil.factory.newDocumentBuilder().parse(
- new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
- System.out.println(toString(convertedDoc.getDocumentElement()));
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreComments(true);
- new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
- .getDocumentElement())),
- XMLUnit.buildTestDocument(toString(convertedDoc
- .getDocumentElement()))).similar();
- System.out.println(toString(expectedDoc.getDocumentElement()));
-
- // now we will try to convert xml back to normalize node.
- ContainerNode cn =
- (ContainerNode) EncoderDecoderUtil.decode(
- parseTestSchema("/test.yang"), nnXml);
- junit.framework.Assert.assertEquals(listLeafListWithAttributes(), cn);
-
- }
-
- @Test
- public void testInMemoryTestModelProtoBuffEncoding() throws Exception {
-
- SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
- EncoderDecoderUtil.encode(parseTestSchema("/odl-datastore-test.yang"),
- TestModel.createFamily());
-
- Document convertedDoc =
- EncoderDecoderUtil.factory.newDocumentBuilder().parse(
- new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
- System.out.println(toString(convertedDoc.getDocumentElement()));
-
- // now we will try to convert xml back to normalize node.
- ContainerNode cn =
- (ContainerNode) EncoderDecoderUtil.decode(
- parseTestSchema("/odl-datastore-test.yang"), nnXml);
- junit.framework.Assert.assertEquals(TestModel.createFamily(), cn);
-
-
- }
}
package org.opendaylight.controller.cluster.datastore.util;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
public class TestModel {
- public static final QName TEST_QNAME = QName.create(
- "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test",
- "2014-03-13", "test");
-
- public static final QName AUG_QNAME = QName.create(
- "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
- "2014-03-13", "name");
-
- public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
- public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME,
- "outer-list");
- public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME,
- "inner-list");
- public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME,
- "outer-choice");
- public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
- public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
- public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
- private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
- private static final String DATASTORE_AUG_YANG =
- "/odl-datastore-augmentation.yang";
- private static final String DATASTORE_TEST_NOTIFICATION_YANG =
- "/odl-datastore-test-notification.yang";
-
-
- public static final InstanceIdentifier TEST_PATH = InstanceIdentifier
- .of(TEST_QNAME);
- public static final InstanceIdentifier DESC_PATH = InstanceIdentifier
- .builder(TEST_PATH).node(DESC_QNAME).build();
- public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier
- .builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
- public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
- public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
-
- private static final Integer ONE_ID = 1;
- private static final Integer TWO_ID = 2;
- private static final String TWO_ONE_NAME = "one";
- private static final String TWO_TWO_NAME = "two";
- private static final String DESC = "Hello there";
-
- // Family specific constants
- public static final QName FAMILY_QNAME =
- QName
- .create(
- "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test",
- "2014-04-15", "family");
- public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME,
- "children");
- public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME,
- "grand-children");
- public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME,
- "child-number");
- public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
- "child-name");
- public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(
- FAMILY_QNAME, "grand-child-number");
- public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
- "grand-child-name");
-
- public static final InstanceIdentifier FAMILY_PATH = InstanceIdentifier
- .of(FAMILY_QNAME);
- public static final InstanceIdentifier FAMILY_DESC_PATH = InstanceIdentifier
- .builder(FAMILY_PATH).node(DESC_QNAME).build();
- public static final InstanceIdentifier CHILDREN_PATH = InstanceIdentifier
- .builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
-
- private static final Integer FIRST_CHILD_ID = 1;
- private static final Integer SECOND_CHILD_ID = 2;
-
- private static final String FIRST_CHILD_NAME = "first child";
- private static final String SECOND_CHILD_NAME = "second child";
-
- private static final Integer FIRST_GRAND_CHILD_ID = 1;
- private static final Integer SECOND_GRAND_CHILD_ID = 2;
-
- private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
- private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
-
- // first child
- private static final InstanceIdentifier CHILDREN_1_PATH = InstanceIdentifier
- .builder(CHILDREN_PATH)
- .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) //
- .build();
- private static final InstanceIdentifier CHILDREN_1_NAME_PATH =
- InstanceIdentifier.builder(CHILDREN_PATH)
- .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) //
- .build();
-
- private static final InstanceIdentifier CHILDREN_2_PATH = InstanceIdentifier
- .builder(CHILDREN_PATH)
- .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) //
- .build();
- private static final InstanceIdentifier CHILDREN_2_NAME_PATH =
- InstanceIdentifier.builder(CHILDREN_PATH)
- .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) //
- .build();
-
-
- private static final InstanceIdentifier GRAND_CHILD_1_PATH =
- InstanceIdentifier.builder(CHILDREN_1_PATH)
- .node(GRAND_CHILDREN_QNAME)
- //
- .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
- FIRST_GRAND_CHILD_ID) //
- .build();
-
- private static final InstanceIdentifier GRAND_CHILD_1_NAME_PATH =
- InstanceIdentifier.builder(CHILDREN_1_PATH)
- .node(GRAND_CHILDREN_QNAME)
- //
- .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
- FIRST_GRAND_CHILD_NAME) //
- .build();
-
- private static final InstanceIdentifier GRAND_CHILD_2_PATH =
- InstanceIdentifier.builder(CHILDREN_2_PATH)
- .node(GRAND_CHILDREN_QNAME)
- //
- .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
- SECOND_GRAND_CHILD_ID) //
- .build();
-
- private static final InstanceIdentifier GRAND_CHILD_2_NAME_PATH =
- InstanceIdentifier.builder(CHILDREN_2_PATH)
- .node(GRAND_CHILDREN_QNAME)
- //
- .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
- SECOND_GRAND_CHILD_NAME) //
- .build();
-
- private static final InstanceIdentifier DESC_PATH_ID = InstanceIdentifier
- .builder(DESC_PATH).build();
- private static final InstanceIdentifier OUTER_LIST_1_PATH =
- InstanceIdentifier.builder(OUTER_LIST_PATH)
- .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) //
- .build();
-
- private static final InstanceIdentifier OUTER_LIST_2_PATH =
- InstanceIdentifier.builder(OUTER_LIST_PATH)
- .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
- .build();
-
- private static final InstanceIdentifier TWO_TWO_PATH = InstanceIdentifier
- .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) //
- .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) //
- .build();
-
- private static final InstanceIdentifier TWO_TWO_VALUE_PATH =
- InstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) //
- .build();
-
- private static final MapEntryNode BAR_NODE = mapEntryBuilder(
- OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
- .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
- .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
- .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
- .build()) //
- .build();
-
- public static final InputStream getDatastoreTestInputStream() {
- return getInputStream(DATASTORE_TEST_YANG);
- }
-
- public static final InputStream getDatastoreAugInputStream() {
- return getInputStream(DATASTORE_AUG_YANG);
- }
-
- public static final InputStream getDatastoreTestNotificationInputStream() {
- return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
- }
-
- private static InputStream getInputStream(final String resourceName) {
- return TestModel.class.getResourceAsStream(resourceName);
- }
-
- public static SchemaContext createTestContext() {
- List<InputStream> inputStreams = new ArrayList<>();
- inputStreams.add(getDatastoreTestInputStream());
- inputStreams.add(getDatastoreAugInputStream());
- inputStreams.add(getDatastoreTestNotificationInputStream());
-
- YangParserImpl parser = new YangParserImpl();
- Set<Module> modules = parser.parseYangModelsFromStreams(inputStreams);
- return parser.resolveSchemaContext(modules);
- }
-
- /**
- * Returns a test document
- *
- * <pre>
- * test
- * outer-list
- * id 1
- * outer-list
- * id 2
- * inner-list
- * name "one"
- * inner-list
- * name "two"
- *
- * </pre>
- *
- * @return
- */
- public static NormalizedNode<?, ?> createDocumentOne(
- SchemaContext schemaContext) {
- return ImmutableContainerNodeBuilder
- .create()
- .withNodeIdentifier(
- new InstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
- .withChild(createTestContainer()).build();
-
- }
-
- public static ContainerNode createTestContainer() {
-
-
- final LeafSetEntryNode<Object> nike =
- ImmutableLeafSetEntryNodeBuilder
- .create()
- .withNodeIdentifier(
- new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
- "shoe"), "nike")).withValue("nike").build();
- final LeafSetEntryNode<Object> puma =
- ImmutableLeafSetEntryNodeBuilder
- .create()
- .withNodeIdentifier(
- new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
- "shoe"), "puma")).withValue("puma").build();
- final LeafSetNode<Object> shoes =
- ImmutableLeafSetNodeBuilder
- .create()
- .withNodeIdentifier(
- new InstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME,
- "shoe"))).withChild(nike).withChild(puma).build();
+ public static final QName TEST_QNAME = QName.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test",
+ "2014-03-13", "test");
+
+ public static final QName AUG_NAME_QNAME = QName.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
+ "2014-03-13", "name");
+
+ public static final QName AUG_CONT_QNAME = QName.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
+ "2014-03-13", "cont");
+
+
+ public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
+ public static final QName POINTER_QNAME =
+ QName.create(TEST_QNAME, "pointer");
+ public static final QName SOME_REF_QNAME =
+ QName.create(TEST_QNAME, "some-ref");
+ public static final QName MYIDENTITY_QNAME =
+ QName.create(TEST_QNAME, "myidentity");
+ public static final QName SWITCH_FEATURES_QNAME =
+ QName.create(TEST_QNAME, "switch-features");
+
+ public static final QName AUGMENTED_LIST_QNAME =
+ QName.create(TEST_QNAME, "augmented-list");
+
+ public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME,
+ "outer-list");
+ public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME,
+ "inner-list");
+ public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME,
+ "outer-choice");
+ public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
+ public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
+ public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
+ private static final String DATASTORE_TEST_YANG =
+ "/odl-datastore-test.yang";
+ private static final String DATASTORE_AUG_YANG =
+ "/odl-datastore-augmentation.yang";
+ private static final String DATASTORE_TEST_NOTIFICATION_YANG =
+ "/odl-datastore-test-notification.yang";
+
+
+ public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier
+ .of(TEST_QNAME);
+ public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
+ .builder(TEST_PATH).node(DESC_QNAME).build();
+ public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier
+ .builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+ public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
+ public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
+
+ private static final Integer ONE_ID = 1;
+ private static final Integer TWO_ID = 2;
+ private static final String TWO_ONE_NAME = "one";
+ private static final String TWO_TWO_NAME = "two";
+ private static final String DESC = "Hello there";
+
+ // Family specific constants
+ public static final QName FAMILY_QNAME =
+ QName
+ .create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test",
+ "2014-04-17", "family");
+ public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+ "children");
+ public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+ "grand-children");
+ public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME,
+ "child-number");
+ public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
+ "child-name");
+ public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(
+ FAMILY_QNAME, "grand-child-number");
+ public static final QName GRAND_CHILD_NAME_QNAME =
+ QName.create(FAMILY_QNAME,
+ "grand-child-name");
+
+ public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier
+ .of(FAMILY_QNAME);
+ public static final YangInstanceIdentifier FAMILY_DESC_PATH = YangInstanceIdentifier
+ .builder(FAMILY_PATH).node(DESC_QNAME).build();
+ public static final YangInstanceIdentifier CHILDREN_PATH = YangInstanceIdentifier
+ .builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
+
+ private static final Integer FIRST_CHILD_ID = 1;
+ private static final Integer SECOND_CHILD_ID = 2;
+
+ private static final String FIRST_CHILD_NAME = "first child";
+ private static final String SECOND_CHILD_NAME = "second child";
+
+ private static final Integer FIRST_GRAND_CHILD_ID = 1;
+ private static final Integer SECOND_GRAND_CHILD_ID = 2;
+
+ private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
+ private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
+
+ // first child
+ private static final YangInstanceIdentifier CHILDREN_1_PATH = YangInstanceIdentifier
+ .builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) //
+ .build();
+ private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier CHILDREN_2_PATH = YangInstanceIdentifier
+ .builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) //
+ .build();
+ private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) //
+ .build();
- final LeafSetEntryNode<Object> five =
- ImmutableLeafSetEntryNodeBuilder
+ private static final YangInstanceIdentifier GRAND_CHILD_1_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_1_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_1_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+ FIRST_GRAND_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_2_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_2_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ SECOND_GRAND_CHILD_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_2_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+ SECOND_GRAND_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier DESC_PATH_ID = YangInstanceIdentifier
+ .builder(DESC_PATH).build();
+ private static final YangInstanceIdentifier OUTER_LIST_1_PATH =
+ YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+ .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier OUTER_LIST_2_PATH =
+ YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+ .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier
+ .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) //
+ .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH =
+ YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) //
+ .build();
+
+ private static final MapEntryNode BAR_NODE = mapEntryBuilder(
+ OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+ .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
+ .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
+ .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
+ .build()) //
+ .build();
+
+ public static final InputStream getDatastoreTestInputStream() {
+ return getInputStream(DATASTORE_TEST_YANG);
+ }
+
+ public static final InputStream getDatastoreAugInputStream() {
+ return getInputStream(DATASTORE_AUG_YANG);
+ }
+
+ public static final InputStream getDatastoreTestNotificationInputStream() {
+ return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
+ }
+
+ private static InputStream getInputStream(final String resourceName) {
+ return TestModel.class.getResourceAsStream(resourceName);
+ }
+
+ public static SchemaContext createTestContext() {
+ List<InputStream> inputStreams = new ArrayList<>();
+ inputStreams.add(getDatastoreTestInputStream());
+ inputStreams.add(getDatastoreAugInputStream());
+ inputStreams.add(getDatastoreTestNotificationInputStream());
+
+ YangParserImpl parser = new YangParserImpl();
+ Set<Module> modules = parser.parseYangModelsFromStreams(inputStreams);
+ return parser.resolveSchemaContext(modules);
+ }
+
+ /**
+ * Returns a test document
+ * <p/>
+ * <pre>
+ * test
+ * outer-list
+ * id 1
+ * outer-list
+ * id 2
+ * inner-list
+ * name "one"
+ * inner-list
+ * name "two"
+ *
+ * </pre>
+ *
+ * @return
+ */
+ public static NormalizedNode<?, ?> createDocumentOne(
+ SchemaContext schemaContext) {
+ return ImmutableContainerNodeBuilder
.create()
.withNodeIdentifier(
- (new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
- "number"), 5))).withValue(5).build();
- final LeafSetEntryNode<Object> fifteen =
- ImmutableLeafSetEntryNodeBuilder
+ new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
+ .withChild(createTestContainer()).build();
+
+ }
+
+ public static ContainerNode createTestContainer() {
+
+
+ // Create a list of shoes
+ // This is to test leaf list entry
+ final LeafSetEntryNode<Object> nike =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(
+ QName.create(TEST_QNAME,
+ "shoe"), "nike")
+ ).withValue("nike").build();
+
+ final LeafSetEntryNode<Object> puma =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(
+ QName.create(TEST_QNAME,
+ "shoe"), "puma")
+ ).withValue("puma").build();
+
+ final LeafSetNode<Object> shoes =
+ ImmutableLeafSetNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(
+ QName.create(TEST_QNAME,
+ "shoe"))
+ ).withChild(nike).withChild(puma).build();
+
+
+ // Test a leaf-list where each entry contains an identity
+ final LeafSetEntryNode<Object> cap1 =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(
+ QName.create(TEST_QNAME,
+ "capability"), DESC_QNAME)
+ ).withValue(DESC_QNAME).build();
+
+ final LeafSetNode<Object> capabilities =
+ ImmutableLeafSetNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(
+ QName.create(TEST_QNAME,
+ "capability"))
+ ).withChild(cap1).build();
+
+ ContainerNode switchFeatures = ImmutableContainerNodeBuilder
.create()
- .withNodeIdentifier(
- (new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
- "number"), 15))).withValue(15).build();
- final LeafSetNode<Object> numbers =
- ImmutableLeafSetNodeBuilder
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(
+ SWITCH_FEATURES_QNAME))
+ .withChild(capabilities)
+ .build();
+
+ // Create a leaf list with numbers
+ final LeafSetEntryNode<Object> five =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ (new YangInstanceIdentifier.NodeWithValue(
+ QName.create(TEST_QNAME,
+ "number"), 5))
+ ).withValue(5).build();
+ final LeafSetEntryNode<Object> fifteen =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ (new YangInstanceIdentifier.NodeWithValue(
+ QName.create(TEST_QNAME,
+ "number"), 15))
+ ).withValue(15).build();
+ final LeafSetNode<Object> numbers =
+ ImmutableLeafSetNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(
+ QName.create(TEST_QNAME,
+ "number"))
+ ).withChild(five).withChild(fifteen).build();
+
+
+ // Create augmentations
+ MapEntryNode mapEntry = createAugmentedListEntry(1, "First Test");
+
+
+ // Create the document
+ return ImmutableContainerNodeBuilder
.create()
.withNodeIdentifier(
- new InstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME,
- "number"))).withChild(five).withChild(fifteen).build();
-
-
- Set<QName> childAugmentations = new HashSet<>();
- childAugmentations.add(AUG_QNAME);
- final InstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
- new InstanceIdentifier.AugmentationIdentifier(null, childAugmentations);
- final AugmentationNode augmentationNode =
- Builders.augmentationBuilder()
- .withNodeIdentifier(augmentationIdentifier)
- .withChild(ImmutableNodes.leafNode(AUG_QNAME, "First Test"))
+ new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
+ .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
+ .withChild(ImmutableNodes.leafNode(POINTER_QNAME, "pointer"))
+ .withChild(ImmutableNodes.leafNode(SOME_REF_QNAME,
+ YangInstanceIdentifier.builder().build()))
+ .withChild(ImmutableNodes.leafNode(MYIDENTITY_QNAME, DESC_QNAME))
+
+ //.withChild(augmentationNode)
+ .withChild(shoes)
+ .withChild(numbers)
+ .withChild(switchFeatures)
+ .withChild(mapNodeBuilder(AUGMENTED_LIST_QNAME).withChild(mapEntry).build())
+ .withChild(
+ mapNodeBuilder(OUTER_LIST_QNAME)
+ .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
+ .withChild(BAR_NODE).build()
+ ).build();
+
+ }
+
+ public static MapEntryNode createAugmentedListEntry(int id, String name) {
+
+ Set<QName> childAugmentations = new HashSet<>();
+ childAugmentations.add(AUG_CONT_QNAME);
+
+ ContainerNode augCont = ImmutableContainerNodeBuilder
+ .create()
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(AUG_CONT_QNAME))
+ .withChild(ImmutableNodes.leafNode(AUG_NAME_QNAME, name))
.build();
- return ImmutableContainerNodeBuilder
- .create()
- .withNodeIdentifier(new InstanceIdentifier.NodeIdentifier(TEST_QNAME))
- .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
- .withChild(augmentationNode)
- .withChild(shoes)
- .withChild(numbers)
- .withChild(
- mapNodeBuilder(OUTER_LIST_QNAME)
- .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
- .withChild(BAR_NODE).build()).build();
-
- }
-
-
- public static ContainerNode createFamily() {
- final DataContainerNodeAttrBuilder<InstanceIdentifier.NodeIdentifier, ContainerNode> familyContainerBuilder =
- ImmutableContainerNodeBuilder.create().withNodeIdentifier(
- new InstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
-
- final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
- mapNodeBuilder(CHILDREN_QNAME);
-
- final DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstChildBuilder =
- mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
- final DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondChildBuilder =
- mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);
-
- final DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstGrandChildBuilder =
- mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
- FIRST_GRAND_CHILD_ID);
- final DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondGrandChildBuilder =
- mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
- SECOND_GRAND_CHILD_ID);
-
- firstGrandChildBuilder
- .withChild(
- ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
- FIRST_GRAND_CHILD_ID)).withChild(
- ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
- FIRST_GRAND_CHILD_NAME));
-
- secondGrandChildBuilder.withChild(
- ImmutableNodes
- .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
- .withChild(
- ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
- SECOND_GRAND_CHILD_NAME));
- firstChildBuilder
- .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
- .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
- .withChild(
- mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
- firstGrandChildBuilder.build()).build());
+ final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
+ new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations);
- secondChildBuilder
- .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
- .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
- .withChild(
- mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
- firstGrandChildBuilder.build()).build());
+ final AugmentationNode augmentationNode =
+ Builders.augmentationBuilder()
+ .withNodeIdentifier(augmentationIdentifier)
+ .withChild(augCont)
+ .build();
- childrenBuilder.withChild(firstChildBuilder.build());
- childrenBuilder.withChild(secondChildBuilder.build());
-
- return familyContainerBuilder.withChild(childrenBuilder.build()).build();
- }
+ return ImmutableMapEntryNodeBuilder.create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+ AUGMENTED_LIST_QNAME, ID_QNAME, id))
+ .withChild(ImmutableNodes.leafNode(ID_QNAME, id))
+ .withChild(augmentationNode).build();
+ }
+
+
+ public static ContainerNode createFamily() {
+ final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
+ familyContainerBuilder =
+ ImmutableContainerNodeBuilder.create().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
+
+ final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
+ mapNodeBuilder(CHILDREN_QNAME);
+
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+ firstChildBuilder =
+ mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+ secondChildBuilder =
+ mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME,
+ SECOND_CHILD_ID);
+
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+ firstGrandChildBuilder =
+ mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID);
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+ secondGrandChildBuilder =
+ mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ SECOND_GRAND_CHILD_ID);
+
+ firstGrandChildBuilder
+ .withChild(
+ ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID)
+ ).withChild(
+ ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+ FIRST_GRAND_CHILD_NAME)
+ );
+
+ secondGrandChildBuilder.withChild(
+ ImmutableNodes
+ .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID)
+ )
+ .withChild(
+ ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+ SECOND_GRAND_CHILD_NAME)
+ );
+
+ firstChildBuilder
+ .withChild(
+ ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
+ .withChild(
+ ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
+ .withChild(
+ mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+ firstGrandChildBuilder.build()).build()
+ );
+
+
+ secondChildBuilder
+ .withChild(
+ ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
+ .withChild(
+ ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
+ .withChild(
+ mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+ firstGrandChildBuilder.build()).build()
+ );
+
+ childrenBuilder.withChild(firstChildBuilder.build());
+ childrenBuilder.withChild(secondChildBuilder.build());
+
+ return familyContainerBuilder.withChild(childrenBuilder.build())
+ .build();
+ }
}
--- /dev/null
+package org.opendaylight.controller.protobuff.messages.transaction;
+
+/**
+ * @author: syedbahm
+ * Date: 7/7/14
+ */
+public class ShardTransactionMessagesTest {
+
+
+}
--- /dev/null
+module odl-datastore-augmentation {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug";
+ prefix "store-aug";
+
+ import odl-datastore-test {prefix test;revision-date "2014-03-13";}
+
+ revision "2014-03-13" {
+ description "Initial revision.";
+ }
+
+
+ augment "/test:test/test:augmented-list" {
+ container cont {
+ leaf name {
+ type string;
+ }
+ }
+ }
+
+}
--- /dev/null
+module odl-datastore-test-notification {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test";
+ prefix "notification-test-using-family-model";
+
+ revision "2014-04-17" {
+ description "Family structure created on ";
+ }
+
+ container family {
+ leaf desc {
+ type string;
+ }
+ list children {
+ key child-number;
+ leaf child-number {
+ type uint16;
+ }
+ leaf child-name {
+ type string;
+ }
+ list grand-children {
+ key grand-child-number;
+ leaf grand-child-number {
+ type uint16;
+ }
+ leaf grand-child-name {
+ type string;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
module odl-datastore-test {
yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test";
- prefix "notification-test-using-family-model";
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test";
+ prefix "store-test";
- revision "2014-04-15" {
- description "Family structure created on ";
+ revision "2014-03-13" {
+ description "Initial revision.";
}
- container family {
+ identity feature-capability {
+ }
+
+ container test {
leaf desc {
type string;
}
- list children {
- key child-number;
- leaf child-number {
+ list outer-list {
+ key id;
+ leaf id {
type uint16;
}
- leaf child-name {
- type string;
- }
- list grand-children {
- key grand-child-number;
- leaf grand-child-number {
- type uint16;
+ choice outer-choice {
+ case one {
+ leaf one {
+ type string;
+ }
+ }
+ case two-three {
+ leaf two {
+ type string;
+ }
+ leaf three {
+ type string;
+ }
+ }
+ }
+ list inner-list {
+ key name;
+ leaf name {
+ type string;
}
- leaf grand-child-name {
+ leaf value {
type string;
}
}
}
+
+ leaf-list shoe {
+ type string;
+ }
+
+ leaf-list number {
+ type uint8;
+ }
+
+ leaf pointer {
+ type leafref {
+ path "/network-topology/topology/node/termination-point/tp-id";
+ }
+ }
+
+ leaf some-ref {
+ type instance-identifier;
+ }
+
+ leaf myidentity {
+ type identityref {
+ base feature-capability;
+ }
+ }
+
+ container switch-features {
+ leaf-list capability {
+ type identityref {
+ base feature-capability;
+ }
+
+ }
+ }
+
+ list augmented-list {
+ key id;
+
+ leaf id {
+ type uint8;
+ }
+ }
+
+
}
-}
\ No newline at end of file
+}
<groupId>org.opendaylight.controller</groupId>
<artifactId>netconf-util</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-impl</artifactId>
+ </dependency>
<!-- Yang tools-->
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-api</artifactId>
+
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-model-api</artifactId>
+
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-impl</artifactId>
+
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-common</artifactId>
+
</dependency>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-parser-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
import org.opendaylight.controller.remote.rpc.RemoteRpcProviderFactory;
import org.opendaylight.controller.sal.core.api.Broker;
-import org.osgi.framework.BundleContext;
public class RemoteRPCBrokerModule extends org.opendaylight.controller.config.yang.config.remote_rpc_connector.AbstractRemoteRPCBrokerModule {
- private BundleContext bundleContext;
public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
@Override
public java.lang.AutoCloseable createInstance() {
Broker broker = getDomBrokerDependency();
- return RemoteRpcProviderFactory.createInstance(broker, bundleContext);
- }
-
- public void setBundleContext(final BundleContext bundleContext) {
- this.bundleContext = bundleContext;
+ return RemoteRpcProviderFactory.createInstance(broker);
}
}
*/
package org.opendaylight.controller.config.yang.config.remote_rpc_connector;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
-import org.opendaylight.controller.config.spi.Module;
-import org.osgi.framework.BundleContext;
public class RemoteRPCBrokerModuleFactory extends org.opendaylight.controller.config.yang.config.remote_rpc_connector.AbstractRemoteRPCBrokerModuleFactory {
- @Override
- public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
- RemoteRPCBrokerModule module = (RemoteRPCBrokerModule)super.createModule(instanceName,dependencyResolver,bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
- @Override
- public Module createModule(String instanceName, DependencyResolver dependencyResolver,
- DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
- RemoteRPCBrokerModule module = (RemoteRPCBrokerModule)super.createModule(instanceName, dependencyResolver,
- old, bundleContext);
- module.setBundleContext(bundleContext);
- return module;
- }
-
}
import org.opendaylight.controller.remote.rpc.messages.InvokeRoutedRpc;
import org.opendaylight.controller.remote.rpc.messages.InvokeRpc;
import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
-import org.opendaylight.controller.sal.common.util.RpcErrors;
-import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
+import org.opendaylight.controller.remote.rpc.utils.XmlUtils;
import org.opendaylight.controller.sal.core.api.RoutedRpcDefaultImplementation;
import org.opendaylight.controller.sal.core.api.RpcImplementation;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.Set;
}
@Override
- public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, InstanceIdentifier identifier, CompositeNode input) {
+ public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, YangInstanceIdentifier identifier, CompositeNode input) {
InvokeRoutedRpc rpcMsg = new InvokeRoutedRpc(rpc, identifier, input);
return executeMsg(rpcMsg);
}
private ListenableFuture<RpcResult<CompositeNode>> executeMsg(Object rpcMsg) {
- CompositeNode result = null;
- Collection<RpcError> errors = errors = new ArrayList<>();
+ ListenableFuture<RpcResult<CompositeNode>> listenableFuture = null;
+
try {
Object response = ActorUtil.executeLocalOperation(rpcBroker, rpcMsg, ActorUtil.ASK_DURATION, ActorUtil.AWAIT_DURATION);
if(response instanceof RpcResponse) {
+
RpcResponse rpcResponse = (RpcResponse) response;
- result = XmlUtils.xmlToCompositeNode(rpcResponse.getResultCompositeNode());
+ CompositeNode result = XmlUtils.xmlToCompositeNode(rpcResponse.getResultCompositeNode());
+ listenableFuture = Futures.immediateFuture(RpcResultBuilder.success(result).build());
+
} else if(response instanceof ErrorResponse) {
+
ErrorResponse errorResponse = (ErrorResponse) response;
Exception e = errorResponse.getException();
- errors.add(RpcErrors.getRpcError(null, null, null, null, e.getMessage(), null, e.getCause()));
+ final RpcResultBuilder<CompositeNode> failed = RpcResultBuilder.failed();
+ failed.withError(null, null, e.getMessage(), null, null, e.getCause());
+ listenableFuture = Futures.immediateFuture(failed.build());
+
}
} catch (Exception e) {
LOG.error("Error occurred while invoking RPC actor {}", e.toString());
- errors.add(RpcErrors.getRpcError(null, null, null, null, e.getMessage(), null, e.getCause()));
+
+ final RpcResultBuilder<CompositeNode> failed = RpcResultBuilder.failed();
+ failed.withError(null, null, e.getMessage(), null, null, e.getCause());
+ listenableFuture = Futures.immediateFuture(failed.build());
}
- return Futures.immediateFuture(Rpcs.getRpcResult(true, result, errors));
+
+ return listenableFuture;
}
}
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
+import org.opendaylight.controller.remote.rpc.messages.UpdateSchemaContext;
import org.opendaylight.controller.remote.rpc.registry.ClusterWrapper;
import org.opendaylight.controller.remote.rpc.registry.ClusterWrapperImpl;
-import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
import org.opendaylight.controller.sal.core.api.Broker;
import org.opendaylight.controller.sal.core.api.Provider;
import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
-import java.util.Set;
/**
* This is the base class which initialize all the actors, listeners and
* default RPc implementation so remote invocation of rpcs.
*/
-public class RemoteRpcProvider implements AutoCloseable, Provider{
+public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContextListener {
private static final Logger LOG = LoggerFactory.getLogger(RemoteRpcProvider.class);
private final ActorSystem actorSystem;
- private ActorRef rpcBroker;
- private ActorRef rpcRegistry;
private final RpcProvisionRegistry rpcProvisionRegistry;
private Broker.ProviderSession brokerSession;
- private RpcListener rpcListener;
- private RoutedRpcListener routeChangeListener;
- private RemoteRpcImplementation rpcImplementation;
+ private SchemaContext schemaContext;
+ private ActorRef rpcManager;
+
+
public RemoteRpcProvider(ActorSystem actorSystem, RpcProvisionRegistry rpcProvisionRegistry) {
this.actorSystem = actorSystem;
this.rpcProvisionRegistry = rpcProvisionRegistry;
@Override
public void close() throws Exception {
this.actorSystem.shutdown();
- unregisterSupportedRpcs();
- unregisterSupportedRoutedRpcs();
}
@Override
}
private void start() {
- LOG.debug("Starting all rpc listeners.");
+ LOG.info("Starting all rpc listeners and actors.");
// Create actor to handle and sync routing table in cluster
ClusterWrapper clusterWrapper = new ClusterWrapperImpl(actorSystem);
- rpcRegistry = actorSystem.actorOf(RpcRegistry.props(clusterWrapper), "rpc-registry");
-
- // Create actor to invoke and execute rpc
SchemaService schemaService = brokerSession.getService(SchemaService.class);
- SchemaContext schemaContext = schemaService.getGlobalContext();
- rpcBroker = actorSystem.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext), "rpc-broker");
- String rpcBrokerPath = clusterWrapper.getAddress().toString() + "/user/rpc-broker";
- rpcListener = new RpcListener(rpcRegistry, rpcBrokerPath);
- routeChangeListener = new RoutedRpcListener(rpcRegistry, rpcBrokerPath);
- rpcImplementation = new RemoteRpcImplementation(rpcBroker, schemaContext);
- brokerSession.addRpcRegistrationListener(rpcListener);
- rpcProvisionRegistry.registerRouteChangeListener(routeChangeListener);
- rpcProvisionRegistry.setRoutedRpcDefaultDelegate(rpcImplementation);
- announceSupportedRpcs();
- announceSupportedRoutedRpcs();
+ schemaContext = schemaService.getGlobalContext();
- }
+ rpcManager = actorSystem.actorOf(RpcManager.props(clusterWrapper, schemaContext, brokerSession, rpcProvisionRegistry), "rpc");
- /**
- * Add all the locally registered RPCs in the clustered routing table
- */
- private void announceSupportedRpcs(){
- LOG.debug("Adding all supported rpcs to routing table");
- Set<QName> currentlySupported = brokerSession.getSupportedRpcs();
- for (QName rpc : currentlySupported) {
- rpcListener.onRpcImplementationAdded(rpc);
- }
+ LOG.debug("Rpc actors are created.");
}
- /**
- * Add all the locally registered Routed RPCs in the clustered routing table
- */
- private void announceSupportedRoutedRpcs(){
-
- //TODO: announce all routed RPCs as well
- }
-
- /**
- * Un-Register all the supported RPCs from clustered routing table
- */
- private void unregisterSupportedRpcs(){
- LOG.debug("removing all supported rpcs to routing table");
- Set<QName> currentlySupported = brokerSession.getSupportedRpcs();
- for (QName rpc : currentlySupported) {
- rpcListener.onRpcImplementationRemoved(rpc);
- }
- }
-
- /**
- * Un-Register all the locally supported Routed RPCs from clustered routing table
- */
- private void unregisterSupportedRoutedRpcs(){
-
- //TODO: remove all routed RPCs as well
+ @Override
+ public void onGlobalContextUpdated(SchemaContext schemaContext) {
+ this.schemaContext = schemaContext;
+ rpcManager.tell(new UpdateSchemaContext(schemaContext), null);
}
}
import org.opendaylight.controller.sal.core.api.Broker;
import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
-import org.osgi.framework.BundleContext;
public class RemoteRpcProviderFactory {
- public static RemoteRpcProvider createInstance(final Broker broker, final BundleContext bundleContext){
+ public static RemoteRpcProvider createInstance(final Broker broker){
RemoteRpcProvider rpcProvider =
new RemoteRpcProvider(ActorSystemFactory.getInstance(), (RpcProvisionRegistry) broker);
- broker.registerProvider(rpcProvider, bundleContext);
+ broker.registerProvider(rpcProvider);
return rpcProvider;
}
}
*/
package org.opendaylight.controller.remote.rpc;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.sal.connector.api.RpcRouter;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
import java.io.Serializable;
-public class RouteIdentifierImpl implements RpcRouter.RouteIdentifier<QName, QName, InstanceIdentifier>,Serializable {
+public class RouteIdentifierImpl implements RpcRouter.RouteIdentifier<QName, QName, YangInstanceIdentifier>,Serializable {
private static final long serialVersionUID = 1L;
- private QName context;
- private QName type;
- private InstanceIdentifier route;
+ private final QName context;
+ private final QName type;
+ private final YangInstanceIdentifier route;
- public RouteIdentifierImpl(QName context, QName type, InstanceIdentifier route) {
+ public RouteIdentifierImpl(final QName context, final QName type, final YangInstanceIdentifier route) {
+ Preconditions.checkNotNull(type, "Rpc type should not be null");
this.context = context;
this.type = type;
this.route = route;
}
@Override
- public InstanceIdentifier getRoute() {
+ public YangInstanceIdentifier getRoute() {
return this.route;
}
import akka.actor.ActorRef;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
import org.opendaylight.controller.remote.rpc.messages.AddRoutedRpc;
import org.opendaylight.controller.remote.rpc.messages.RemoveRoutedRpc;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
import org.opendaylight.controller.sal.connector.api.RpcRouter;
import org.opendaylight.controller.sal.core.api.RpcRoutingContext;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.Set;
-public class RoutedRpcListener implements RouteChangeListener<RpcRoutingContext, InstanceIdentifier>{
+public class RoutedRpcListener implements RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>{
private static final Logger LOG = LoggerFactory.getLogger(RoutedRpcListener.class);
private final ActorRef rpcRegistry;
private final String actorPath;
public RoutedRpcListener(ActorRef rpcRegistry, String actorPath) {
+ Preconditions.checkNotNull(rpcRegistry, "rpc registry actor should not be null");
+ Preconditions.checkNotNull(actorPath, "actor path of rpc broker on current node should not be null");
+
this.rpcRegistry = rpcRegistry;
this.actorPath = actorPath;
}
@Override
- public void onRouteChange(RouteChange<RpcRoutingContext, InstanceIdentifier> routeChange) {
- Map<RpcRoutingContext, Set<InstanceIdentifier>> announcements = routeChange.getAnnouncements();
+ public void onRouteChange(RouteChange<RpcRoutingContext, YangInstanceIdentifier> routeChange) {
+ Map<RpcRoutingContext, Set<YangInstanceIdentifier>> announcements = routeChange.getAnnouncements();
announce(getRouteIdentifiers(announcements));
- Map<RpcRoutingContext, Set<InstanceIdentifier>> removals = routeChange.getRemovals();
+ Map<RpcRoutingContext, Set<YangInstanceIdentifier>> removals = routeChange.getRemovals();
remove(getRouteIdentifiers(removals));
}
* @param changes
* @return
*/
- private Set<RpcRouter.RouteIdentifier<?, ?, ?>> getRouteIdentifiers(Map<RpcRoutingContext, Set<InstanceIdentifier>> changes) {
+ private Set<RpcRouter.RouteIdentifier<?, ?, ?>> getRouteIdentifiers(Map<RpcRoutingContext, Set<YangInstanceIdentifier>> changes) {
RouteIdentifierImpl routeId = null;
Set<RpcRouter.RouteIdentifier<?, ?, ?>> routeIdSet = new HashSet<>();
for (RpcRoutingContext context : changes.keySet()){
- for (InstanceIdentifier instanceId : changes.get(context)){
+ for (YangInstanceIdentifier instanceId : changes.get(context)){
routeId = new RouteIdentifierImpl(null, context.getRpc(), instanceId);
routeIdSet.add(routeId);
}
import org.opendaylight.controller.remote.rpc.messages.InvokeRoutedRpc;
import org.opendaylight.controller.remote.rpc.messages.InvokeRpc;
import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
+import org.opendaylight.controller.remote.rpc.utils.XmlUtils;
import org.opendaylight.controller.sal.core.api.Broker;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
private static final Logger LOG = LoggerFactory.getLogger(RpcBroker.class);
private final Broker.ProviderSession brokerSession;
private final ActorRef rpcRegistry;
- private final SchemaContext schemaContext;
+ private SchemaContext schemaContext;
private RpcBroker(Broker.ProviderSession brokerSession, ActorRef rpcRegistry, SchemaContext schemaContext){
this.brokerSession = brokerSession;
try {
RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, msg.getRpc(), msg.getIdentifier());
GetRoutedRpc routedRpcMsg = new GetRoutedRpc(routeId);
- GetRoutedRpcReply rpcReply = (GetRoutedRpcReply)ActorUtil.executeLocalOperation(rpcRegistry, routedRpcMsg, ActorUtil.LOCAL_ASK_DURATION, ActorUtil.LOCAL_AWAIT_DURATION);
+ GetRoutedRpcReply rpcReply = (GetRoutedRpcReply) ActorUtil.executeLocalOperation(rpcRegistry, routedRpcMsg, ActorUtil.LOCAL_ASK_DURATION, ActorUtil.LOCAL_AWAIT_DURATION);
String remoteActorPath = rpcReply.getRoutePath();
if(remoteActorPath == null) {
String remoteActorPath = rpcReply.getRoutePath();
if(remoteActorPath == null) {
- LOG.debug("No remote actor found for rpc execution.");
+ LOG.debug("No remote actor found for rpc {{}}.", msg.getRpc());
getSender().tell(new ErrorResponse(
- new IllegalStateException("No remote actor found for rpc execution.")), self());
+ new IllegalStateException("No remote actor found for rpc execution of : " + msg.getRpc())), self());
} else {
+
ExecuteRpc executeMsg = new ExecuteRpc(XmlUtils.inputCompositeNodeToXml(msg.getInput(), schemaContext), msg.getRpc());
Object operationRes = ActorUtil.executeRemoteOperation(this.context().actorSelection(remoteActorPath),
executeMsg, ActorUtil.REMOTE_ASK_DURATION, ActorUtil.REMOTE_AWAIT_DURATION);
try {
Future<RpcResult<CompositeNode>> rpc = brokerSession.rpc(msg.getRpc(), XmlUtils.inputXmlToCompositeNode(msg.getRpc(), msg.getInputCompositeNode(), schemaContext));
RpcResult<CompositeNode> rpcResult = rpc != null ? rpc.get():null;
-
CompositeNode result = rpcResult != null ? rpcResult.getResult() : null;
getSender().tell(new RpcResponse(XmlUtils.outputCompositeNodeToXml(result, schemaContext)), self());
} catch (Exception e) {
import akka.actor.ActorRef;
import org.opendaylight.controller.remote.rpc.messages.AddRpc;
import org.opendaylight.controller.remote.rpc.messages.RemoveRpc;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
import org.opendaylight.yangtools.yang.common.QName;
import org.slf4j.Logger;
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.remote.rpc;
+
+
+import akka.actor.ActorRef;
+import akka.actor.OneForOneStrategy;
+import akka.actor.Props;
+import akka.actor.SupervisorStrategy;
+import akka.japi.Creator;
+import akka.japi.Function;
+import org.opendaylight.controller.remote.rpc.messages.UpdateSchemaContext;
+import org.opendaylight.controller.remote.rpc.registry.ClusterWrapper;
+import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import scala.concurrent.duration.Duration;
+import java.util.Set;
+
+/**
+ * This class acts as a supervisor, creates all the actors, resumes them, if an exception is thrown.
+ *
+ * It also starts the rpc listeners
+ */
+
+public class RpcManager extends AbstractUntypedActor {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RpcManager.class);
+
+ private SchemaContext schemaContext;
+ private final ClusterWrapper clusterWrapper;
+ private ActorRef rpcBroker;
+ private ActorRef rpcRegistry;
+ private final Broker.ProviderSession brokerSession;
+ private RpcListener rpcListener;
+ private RoutedRpcListener routeChangeListener;
+ private RemoteRpcImplementation rpcImplementation;
+ private final RpcProvisionRegistry rpcProvisionRegistry;
+
+ private RpcManager(ClusterWrapper clusterWrapper, SchemaContext schemaContext,
+ Broker.ProviderSession brokerSession, RpcProvisionRegistry rpcProvisionRegistry) {
+ this.clusterWrapper = clusterWrapper;
+ this.schemaContext = schemaContext;
+ this.brokerSession = brokerSession;
+ this.rpcProvisionRegistry = rpcProvisionRegistry;
+
+ createRpcActors();
+ startListeners();
+ }
+
+
+ public static Props props(final ClusterWrapper clusterWrapper, final SchemaContext schemaContext,
+ final Broker.ProviderSession brokerSession, final RpcProvisionRegistry rpcProvisionRegistry) {
+ return Props.create(new Creator<RpcManager>() {
+ @Override
+ public RpcManager create() throws Exception {
+ return new RpcManager(clusterWrapper, schemaContext, brokerSession, rpcProvisionRegistry);
+ }
+ });
+ }
+
+ private void createRpcActors() {
+ LOG.debug("Create rpc registry and broker actors");
+
+ rpcRegistry = getContext().actorOf(RpcRegistry.props(clusterWrapper), "rpc-registry");
+ rpcBroker = getContext().actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext), "rpc-broker");
+ }
+
+ private void startListeners() {
+ LOG.debug("Registers rpc listeners");
+
+ String rpcBrokerPath = clusterWrapper.getAddress().toString() + "/user/rpc/rpc-broker";
+ rpcListener = new RpcListener(rpcRegistry, rpcBrokerPath);
+ routeChangeListener = new RoutedRpcListener(rpcRegistry, rpcBrokerPath);
+ rpcImplementation = new RemoteRpcImplementation(rpcBroker, schemaContext);
+
+ brokerSession.addRpcRegistrationListener(rpcListener);
+ rpcProvisionRegistry.registerRouteChangeListener(routeChangeListener);
+ rpcProvisionRegistry.setRoutedRpcDefaultDelegate(rpcImplementation);
+ announceSupportedRpcs();
+ }
+
+ /**
+ * Add all the locally registered RPCs in the clustered routing table
+ */
+ private void announceSupportedRpcs(){
+ LOG.debug("Adding all supported rpcs to routing table");
+ Set<QName> currentlySupported = brokerSession.getSupportedRpcs();
+ for (QName rpc : currentlySupported) {
+ rpcListener.onRpcImplementationAdded(rpc);
+ }
+ }
+
+
+ @Override
+ protected void handleReceive(Object message) throws Exception {
+ if(message instanceof UpdateSchemaContext) {
+ updateSchemaContext((UpdateSchemaContext) message);
+ }
+
+ }
+
+ private void updateSchemaContext(UpdateSchemaContext message) {
+ this.schemaContext = message.getSchemaContext();
+ }
+
+ @Override
+ public SupervisorStrategy supervisorStrategy() {
+ return new OneForOneStrategy(10, Duration.create("1 minute"),
+ new Function<Throwable, SupervisorStrategy.Directive>() {
+ @Override
+ public SupervisorStrategy.Directive apply(Throwable t) {
+ return SupervisorStrategy.resume();
+ }
+ }
+ );
+ }
+}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.remote.rpc;
-
-import com.google.common.base.Optional;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.Node;
-import org.opendaylight.yangtools.yang.data.api.SimpleNode;
-import org.opendaylight.yangtools.yang.data.impl.XmlTreeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-import javax.activation.UnsupportedDataTypeException;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Set;
-
-public class XmlUtils {
-
- private static final Logger LOG = LoggerFactory.getLogger(XmlUtils.class);
-
- public static String inputCompositeNodeToXml(CompositeNode cNode, SchemaContext schemaContext){
- if (cNode == null) return new String();
-
- //Document domTree = NodeUtils.buildShadowDomTree(cNode);
- Document domTree = null;
- try {
- Set<RpcDefinition> rpcs = schemaContext.getOperations();
- for(RpcDefinition rpc : rpcs) {
- if(rpc.getQName().equals(cNode.getNodeType())){
- domTree = XmlDocumentUtils.toDocument(cNode, rpc.getInput(), XmlDocumentUtils.defaultValueCodecProvider());
- break;
- }
- }
-
- } catch (UnsupportedDataTypeException e) {
- LOG.error("Error during translation of CompositeNode to Document", e);
- }
- return domTransformer(domTree);
- }
-
- public static String outputCompositeNodeToXml(CompositeNode cNode, SchemaContext schemaContext){
- if (cNode == null) return new String();
-
- //Document domTree = NodeUtils.buildShadowDomTree(cNode);
- Document domTree = null;
- try {
- Set<RpcDefinition> rpcs = schemaContext.getOperations();
- for(RpcDefinition rpc : rpcs) {
- if(rpc.getQName().equals(cNode.getNodeType())){
- domTree = XmlDocumentUtils.toDocument(cNode, rpc.getInput(), XmlDocumentUtils.defaultValueCodecProvider());
- break;
- }
- }
-
- } catch (UnsupportedDataTypeException e) {
- LOG.error("Error during translation of CompositeNode to Document", e);
- }
- return domTransformer(domTree);
- }
-
- private static String domTransformer(Document domTree) {
- StringWriter writer = new StringWriter();
- try {
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer transformer = tf.newTransformer();
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- transformer.transform(new DOMSource(domTree), new StreamResult(writer));
- } catch (TransformerException e) {
-
- LOG.error("Error during translation of Document to OutputStream", e);
- }
- LOG.debug("compositeNodeToXml " + writer.toString());
-
- return writer.toString();
- }
-
- public static CompositeNode xmlToCompositeNode(String xml){
- if (xml==null || xml.length()==0) return null;
-
- Node<?> dataTree;
- try {
- dataTree = XmlTreeBuilder.buildDataTree(new ByteArrayInputStream(xml.getBytes()));
- } catch (XMLStreamException e) {
- LOG.error("Error during building data tree from XML", e);
- return null;
- }
- if (dataTree == null) {
- LOG.error("data tree is null");
- return null;
- }
- if (dataTree instanceof SimpleNode) {
- LOG.error("RPC XML was resolved as SimpleNode");
- return null;
- }
- return (CompositeNode) dataTree;
- }
-
- public static CompositeNode inputXmlToCompositeNode(QName rpc, String xml, SchemaContext schemaContext){
- if (xml==null || xml.length()==0) return null;
-
- Node<?> dataTree = null;
- try {
-
- Document doc = XmlUtil.readXmlToDocument(xml);
- LOG.debug("xmlToCompositeNode Document is " + xml );
- Set<RpcDefinition> rpcs = schemaContext.getOperations();
- for(RpcDefinition rpcDef : rpcs) {
- if(rpcDef.getQName().equals(rpc)){
- dataTree = XmlDocumentUtils.toDomNode(doc.getDocumentElement(), Optional.<DataSchemaNode>of(rpcDef.getInput()), Optional.of(XmlDocumentUtils.defaultValueCodecProvider()));
- break;
- }
- }
- } catch (SAXException e) {
- LOG.error("Error during building data tree from XML", e);
- } catch (IOException e) {
- LOG.error("Error during building data tree from XML", e);
- }
-
- LOG.debug("xmlToCompositeNode " + dataTree.toString());
- return (CompositeNode) dataTree;
- }
-}
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.sal.connector.api.RpcRouter;
import java.io.Serializable;
public class AddRoutedRpc implements Serializable {
- Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements;
- String actorPath;
+ private final Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements;
+ private final String actorPath;
+
+ public AddRoutedRpc(final Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements, final String actorPath) {
+ Preconditions.checkNotNull(announcements, "Route identifier should not be null");
+ Preconditions.checkNotNull(actorPath, "Actor path should not be null");
- public AddRoutedRpc(Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements, String actorPath) {
this.announcements = announcements;
this.actorPath = actorPath;
}
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
import java.io.Serializable;
public class AddRpc implements Serializable {
- RouteIdentifierImpl routeId;
- String actorPath;
+ private final RouteIdentifierImpl routeId;
+ private final String actorPath;
+
+ public AddRpc(final RouteIdentifierImpl routeId, final String actorPath) {
+ Preconditions.checkNotNull(routeId, "Route identifier should not be null");
+ Preconditions.checkNotNull(actorPath, "Actor path should not be null");
- public AddRpc(RouteIdentifierImpl routeId, String actorPath) {
this.routeId = routeId;
this.actorPath = actorPath;
}
*/
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
+
import java.io.Serializable;
public class ErrorResponse implements Serializable {
- Exception exception;
+ private final Exception exception;
- public ErrorResponse(Exception e) {
+ public ErrorResponse(final Exception e) {
+ Preconditions.checkNotNull(e, "Exception should be present for error message");
this.exception = e;
}
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.yangtools.yang.common.QName;
import java.io.Serializable;
public class ExecuteRpc implements Serializable {
- private String inputCompositeNode;
- private QName rpc;
+ private final String inputCompositeNode;
+ private final QName rpc;
+
+ public ExecuteRpc(final String inputCompositeNode, final QName rpc) {
+ Preconditions.checkNotNull(inputCompositeNode, "Composite Node input string should be present");
+ Preconditions.checkNotNull(rpc, "rpc Qname should not be null");
- public ExecuteRpc(String inputCompositeNode, QName rpc) {
this.inputCompositeNode = inputCompositeNode;
this.rpc = rpc;
}
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
import java.io.Serializable;
public class GetRoutedRpc implements Serializable {
- RouteIdentifierImpl routeId;
+ private final RouteIdentifierImpl routeId;
- public GetRoutedRpc(RouteIdentifierImpl routeId) {
+ public GetRoutedRpc(final RouteIdentifierImpl routeId) {
+ Preconditions.checkNotNull(routeId, "route id should not be null");
this.routeId = routeId;
}
public class GetRoutedRpcReply implements Serializable {
- private String routePath;
+ private final String routePath;
- public GetRoutedRpcReply(String routePath) {
+ public GetRoutedRpcReply(final String routePath) {
this.routePath = routePath;
}
*/
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
import java.io.Serializable;
public class GetRpc implements Serializable {
- RouteIdentifierImpl routeId;
+ private final RouteIdentifierImpl routeId;
- public GetRpc(RouteIdentifierImpl routeId) {
+ public GetRpc(final RouteIdentifierImpl routeId) {
+ Preconditions.checkNotNull(routeId, "Route Id should not be null");
this.routeId = routeId;
}
public class GetRpcReply implements Serializable {
- private String routePath;
+ private final String routePath;
- public GetRpcReply(String routePath) {
+ public GetRpcReply(final String routePath) {
this.routePath = routePath;
}
*/
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import java.io.Serializable;
public class InvokeRoutedRpc implements Serializable {
- private QName rpc;
- private InstanceIdentifier identifier;
- private CompositeNode input;
+ private final QName rpc;
+ private final YangInstanceIdentifier identifier;
+ private final CompositeNode input;
- public InvokeRoutedRpc(QName rpc, InstanceIdentifier identifier, CompositeNode input) {
- this.rpc = rpc;
- this.identifier = identifier;
- this.input = input;
- }
+ public InvokeRoutedRpc(final QName rpc, final YangInstanceIdentifier identifier, final CompositeNode input) {
+ Preconditions.checkNotNull(rpc, "rpc qname should not be null");
+ Preconditions.checkNotNull(identifier, "instance identifier of routed rpc should not be null");
+ Preconditions.checkNotNull(input, "rpc input should not be null");
- public InvokeRoutedRpc(QName rpc, CompositeNode input) {
this.rpc = rpc;
+ this.identifier = identifier;
this.input = input;
}
return rpc;
}
- public InstanceIdentifier getIdentifier() {
+ public YangInstanceIdentifier getIdentifier() {
return identifier;
}
*/
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
public class InvokeRpc implements Serializable {
- private QName rpc;
- private CompositeNode input;
+ private final QName rpc;
+ private final CompositeNode input;
+
+ public InvokeRpc(final QName rpc, final CompositeNode input) {
+ Preconditions.checkNotNull(rpc, "rpc qname should not be null");
+ Preconditions.checkNotNull(input, "rpc input should not be null");
- public InvokeRpc(QName rpc, CompositeNode input) {
this.rpc = rpc;
this.input = input;
}
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.sal.connector.api.RpcRouter;
import java.io.Serializable;
public class RemoveRoutedRpc implements Serializable {
- Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements;
- String actorPath;
+ private final Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements;
+ private final String actorPath;
+
+ public RemoveRoutedRpc(final Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements, final String actorPath) {
+ Preconditions.checkNotNull(announcements, "Route identifier should not be null");
+ Preconditions.checkNotNull(actorPath, "Actor path should not be null");
- public RemoveRoutedRpc(Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements, String actorPath) {
this.announcements = announcements;
this.actorPath = actorPath;
}
package org.opendaylight.controller.remote.rpc.messages;
+import com.google.common.base.Preconditions;
import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
import java.io.Serializable;
public class RemoveRpc implements Serializable {
- RouteIdentifierImpl routeId;
+ private final RouteIdentifierImpl routeId;
+
+ public RemoveRpc(final RouteIdentifierImpl routeId) {
+ Preconditions.checkNotNull(routeId, "Route Id should not be null");
- public RemoveRpc(RouteIdentifierImpl routeId) {
this.routeId = routeId;
}
import java.util.Map;
public class RoutingTableData implements Serializable {
- private Map<RpcRouter.RouteIdentifier<?, ?, ?>, String> rpcMap;
- private Map<RpcRouter.RouteIdentifier<?, ?, ?>, LinkedHashSet<String>> routedRpcMap;
+ private final Map<RpcRouter.RouteIdentifier<?, ?, ?>, String> rpcMap;
+ private final Map<RpcRouter.RouteIdentifier<?, ?, ?>, LinkedHashSet<String>> routedRpcMap;
- public RoutingTableData(Map<RpcRouter.RouteIdentifier<?, ?, ?>, String> rpcMap,
- Map<RpcRouter.RouteIdentifier<?, ?, ?>, LinkedHashSet<String>> routedRpcMap) {
+ public RoutingTableData(final Map<RpcRouter.RouteIdentifier<?, ?, ?>, String> rpcMap,
+ final Map<RpcRouter.RouteIdentifier<?, ?, ?>, LinkedHashSet<String>> routedRpcMap) {
this.rpcMap = rpcMap;
this.routedRpcMap = routedRpcMap;
}
import java.io.Serializable;
public class RpcResponse implements Serializable {
- private String resultCompositeNode;
+ private final String resultCompositeNode;
- public RpcResponse(String resultCompositeNode) {
+ public RpcResponse(final String resultCompositeNode) {
this.resultCompositeNode = resultCompositeNode;
}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.remote.rpc.messages;
+
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class UpdateSchemaContext {
+
+ private final SchemaContext schemaContext;
+
+ public UpdateSchemaContext(final SchemaContext schemaContext) {
+ this.schemaContext = schemaContext;
+ }
+
+ public SchemaContext getSchemaContext() {
+ return schemaContext;
+ }
+}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
*/
-package org.opendaylight.controller.remote.rpc;
+package org.opendaylight.controller.remote.rpc.utils;
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.remote.rpc.utils;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public final class InstanceIdentifierForXmlCodec {
+ private static final Pattern PREDICATE_PATTERN = Pattern.compile("\\[(.*?)\\]");
+ private static final Splitter SLASH_SPLITTER = Splitter.on('/');
+ private static final Splitter COLON_SPLITTER = Splitter.on(':');
+ private static final Splitter AT_SPLITTER = Splitter.on('@');
+ private static final Logger logger = LoggerFactory.getLogger(InstanceIdentifierForXmlCodec.class);
+
+ private InstanceIdentifierForXmlCodec() {
+ throw new UnsupportedOperationException("Utility class");
+ }
+
+ public static YangInstanceIdentifier deserialize(final Element element, final SchemaContext schemaContext) {
+ Preconditions.checkNotNull(element, "Value of element for deserialization can't be null");
+ Preconditions.checkNotNull(schemaContext,
+ "Schema context for deserialization of instance identifier type can't be null");
+
+ final String valueTrimmed = element.getTextContent().trim();
+ logger.debug("Instance identifier derserialize: splitting the text {} with Slash to find path arguments", valueTrimmed);
+ final Iterator<String> xPathParts = SLASH_SPLITTER.split(valueTrimmed).iterator();
+
+ // must be at least "/pr:node"
+ if (!xPathParts.hasNext() || !xPathParts.next().isEmpty() || !xPathParts.hasNext()) {
+ logger.debug("Instance identifier derserialize: No path argument found for element.");
+ return null;
+ }
+
+ List<PathArgument> result = new ArrayList<>();
+ while (xPathParts.hasNext()) {
+ String xPathPartTrimmed = xPathParts.next().trim();
+
+ PathArgument pathArgument = toPathArgument(xPathPartTrimmed, element, schemaContext);
+ if (pathArgument != null) {
+ result.add(pathArgument);
+ }
+ }
+ return YangInstanceIdentifier.create(result);
+ }
+
+ public static Element serialize(final YangInstanceIdentifier id, final Element element) {
+ Preconditions.checkNotNull(id, "Variable should contain instance of instance identifier and can't be null");
+ Preconditions.checkNotNull(element, "DOM element can't be null");
+
+ final RandomPrefix prefixes = new RandomPrefix();
+ final String str = XmlUtils.encodeIdentifier(prefixes, id);
+
+ for (Entry<URI, String> e: prefixes.getPrefixes()) {
+ element.setAttribute("xmlns:" + e.getValue(), e.getKey().toString());
+ }
+ element.setTextContent(str);
+ return element;
+ }
+
+ private static String getIdAndPrefixAsStr(final String pathPart) {
+ int predicateStartIndex = pathPart.indexOf('[');
+ return predicateStartIndex == -1 ? pathPart : pathPart.substring(0, predicateStartIndex);
+ }
+
+ private static PathArgument toPathArgument(final String xPathArgument, final Element element, final SchemaContext schemaContext) {
+ final QName mainQName = toIdentity(xPathArgument, element, schemaContext);
+
+ // predicates
+ final Matcher matcher = PREDICATE_PATTERN.matcher(xPathArgument);
+ final Map<QName, Object> predicates = new HashMap<>();
+ QName currentQName = mainQName;
+
+ while (matcher.find()) {
+ final String predicateStr = matcher.group(1).trim();
+ final int indexOfEqualityMark = predicateStr.indexOf('=');
+ if (indexOfEqualityMark != -1) {
+ final Object predicateValue = toPredicateValue(predicateStr.substring(indexOfEqualityMark + 1));
+ if (predicateValue == null) {
+ return null;
+ }
+
+ if (predicateStr.charAt(0) != '.') {
+ // target is not a leaf-list
+ currentQName = toIdentity(predicateStr.substring(0, indexOfEqualityMark), element, schemaContext);
+ if (currentQName == null) {
+ return null;
+ }
+ }
+ logger.debug("Instance identifier derserialize: finding predicates of node {}", predicateValue);
+ predicates.put(currentQName, predicateValue);
+ }
+ }
+
+ if (predicates.isEmpty()) {
+ return new YangInstanceIdentifier.NodeIdentifier(mainQName);
+ } else {
+ return new YangInstanceIdentifier.NodeIdentifierWithPredicates(mainQName, predicates);
+ }
+
+ }
+
+ public static QName toIdentity(final String xPathArgument, final Element element, final SchemaContext schemaContext) {
+ final String xPathPartTrimmed = getIdAndPrefixAsStr(xPathArgument).trim();
+ final Iterator<String> it = COLON_SPLITTER.split(xPathPartTrimmed).iterator();
+
+ // Empty string
+ if (!it.hasNext()) {
+ return null;
+ }
+
+ final String prefix = it.next().trim();
+ if (prefix.isEmpty()) {
+ return null;
+ }
+
+ // it is not "prefix:value"
+ if (!it.hasNext()) {
+ return null;
+ }
+
+ final String identifier = it.next().trim();
+ if (identifier.isEmpty()) {
+ return null;
+ }
+
+ URI namespace = null;
+ String namespaceStr = null;
+ try {
+ namespaceStr = element.getAttribute("xmlns:"+prefix);
+ namespace = new URI(namespaceStr);
+ } catch (URISyntaxException e) {
+ throw new IllegalArgumentException("It wasn't possible to convert " + namespaceStr + " to URI object.");
+ } catch (NullPointerException e) {
+ throw new IllegalArgumentException("I wasn't possible to get namespace for prefix " + prefix);
+ }
+
+ Module module = schemaContext.findModuleByNamespaceAndRevision(namespace, null);
+ return QName.create(module.getQNameModule(), identifier);
+ }
+
+ private static String trimIfEndIs(final String str, final char end) {
+ final int l = str.length() - 1;
+ if (str.charAt(l) != end) {
+ return null;
+ }
+
+ return str.substring(1, l);
+ }
+
+ private static Object toPredicateValue(final String predicatedValue) {
+ logger.debug("Instance identifier derserialize: converting the predicate vstring to object {}", predicatedValue);
+ final String predicatedValueTrimmed = predicatedValue.trim();
+ if (predicatedValue.isEmpty()) {
+ return null;
+ }
+ String updatedValue = null;
+ switch (predicatedValueTrimmed.charAt(0)) {
+ case '"':
+ updatedValue = trimIfEndIs(predicatedValueTrimmed, '"');
+ break;
+ case '\'':
+ updatedValue = trimIfEndIs(predicatedValueTrimmed, '\'');
+ break;
+ default:
+ updatedValue = predicatedValueTrimmed;
+ }
+ Iterator<String> it = AT_SPLITTER.split(updatedValue).iterator();
+ // Empty string
+ if (!it.hasNext()) {
+ return null;
+ }
+
+ final String value = it.next().trim();
+ if (value.isEmpty()) {
+ return null;
+ }
+
+ if (!it.hasNext()) {
+ return value;
+ }
+
+ final String type = it.next().trim();
+ if (type.isEmpty()) {
+ return value;
+ }
+ Object predicateObject = null;
+ try {
+ logger.debug("Instance identifier derserialize: converting the predicate value {{}}to correct object type {{}}", value, type);
+ predicateObject = Class.forName(type).getConstructor(String.class).newInstance(value);
+ } catch (Exception e) {
+ logger.error("Could not convert to valid type of value", e);
+ }
+ return predicateObject;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.remote.rpc.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Picked from Yang tools because it was not public class
+ */
+
+final class RandomPrefix {
+ final Map<URI, String> prefixes = new HashMap<>();
+
+ Iterable<Entry<URI, String>> getPrefixes() {
+ return prefixes.entrySet();
+ }
+
+ String encodeQName(final QName qname) {
+ String prefix = prefixes.get(qname.getNamespace());
+ if (prefix == null) {
+ prefix = qname.getPrefix();
+ if (prefix == null || prefix.isEmpty() || prefixes.containsValue(prefix)) {
+ final ThreadLocalRandom random = ThreadLocalRandom.current();
+ do {
+ final StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < 4; i++) {
+ sb.append((char)('a' + random.nextInt(25)));
+ }
+
+ prefix = sb.toString();
+ } while (prefixes.containsValue(prefix));
+ }
+
+ prefixes.put(qname.getNamespace(), prefix);
+ }
+
+ return prefix + ':' + qname.getLocalName();
+ }
+}
--- /dev/null
+/*
+ * 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.remote.rpc.utils;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.ModifyAction;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import javax.activation.UnsupportedDataTypeException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.dom.DOMResult;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkState;
+
+public class XmlDocumentUtils {
+ private static class ElementWithSchemaContext {
+ Element element;
+ SchemaContext schemaContext;
+
+ ElementWithSchemaContext(final Element element,final SchemaContext schemaContext) {
+ this.schemaContext = schemaContext;
+ this.element = element;
+ }
+
+ Element getElement() {
+ return element;
+ }
+
+ SchemaContext getSchemaContext() {
+ return schemaContext;
+ }
+ }
+
+ public static final QName OPERATION_ATTRIBUTE_QNAME = QName.create(URI.create("urn:ietf:params:xml:ns:netconf:base:1.0"), null, "operation");
+ private static final Logger logger = LoggerFactory.getLogger(XmlDocumentUtils.class);
+ private static final XMLOutputFactory FACTORY = XMLOutputFactory.newFactory();
+
+ /**
+ * Converts Data DOM structure to XML Document for specified XML Codec Provider and corresponding
+ * Data Node Container schema. The CompositeNode data parameter enters as root of Data DOM tree and will
+ * be transformed to root in XML Document. Each element of Data DOM tree is compared against specified Data
+ * Node Container Schema and transformed accordingly.
+ *
+ * @param data Data DOM root element
+ * @param schema Data Node Container Schema
+ * @param codecProvider XML Codec Provider
+ * @return new instance of XML Document
+ * @throws javax.activation.UnsupportedDataTypeException
+ */
+ public static Document toDocument(final CompositeNode data, final DataNodeContainer schema, final XmlCodecProvider codecProvider)
+ throws UnsupportedDataTypeException {
+ Preconditions.checkNotNull(data);
+ Preconditions.checkNotNull(schema);
+
+ if (!(schema instanceof ContainerSchemaNode || schema instanceof ListSchemaNode)) {
+ throw new UnsupportedDataTypeException("Schema can be ContainerSchemaNode or ListSchemaNode. Other types are not supported yet.");
+ }
+
+ final DOMResult result = new DOMResult(getDocument());
+ try {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(result);
+ XmlStreamUtils.create(codecProvider).writeDocument(writer, data, (SchemaNode)schema);
+ writer.close();
+ return (Document)result.getNode();
+ } catch (XMLStreamException e) {
+ logger.error("Failed to serialize data {}", data, e);
+ return null;
+ }
+ }
+
+ public static Document getDocument() {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ Document doc = null;
+ try {
+ DocumentBuilder bob = dbf.newDocumentBuilder();
+ doc = bob.newDocument();
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+ return doc;
+ }
+
+
+ public static QName qNameFromElement(final Element xmlElement) {
+ String namespace = xmlElement.getNamespaceURI();
+ String localName = xmlElement.getLocalName();
+ return QName.create(namespace != null ? URI.create(namespace) : null, null, localName);
+ }
+
+ private static Node<?> toNodeWithSchema(final Element xmlElement, final DataSchemaNode schema, final XmlCodecProvider codecProvider,final SchemaContext schemaCtx) {
+ checkQName(xmlElement, schema.getQName());
+ if (schema instanceof DataNodeContainer) {
+ return toCompositeNodeWithSchema(xmlElement, schema.getQName(), (DataNodeContainer) schema, schemaCtx);
+ } else if (schema instanceof LeafSchemaNode) {
+ return toSimpleNodeWithType(xmlElement, (LeafSchemaNode) schema, codecProvider,schemaCtx);
+ } else if (schema instanceof LeafListSchemaNode) {
+ return toSimpleNodeWithType(xmlElement, (LeafListSchemaNode) schema, codecProvider,schemaCtx);
+ }
+ return null;
+ }
+
+
+
+ private static Node<?> toSimpleNodeWithType(final Element xmlElement, final LeafSchemaNode schema,
+ final XmlCodecProvider codecProvider,final SchemaContext schemaCtx) {
+ TypeDefinitionAwareCodec<? extends Object, ? extends TypeDefinition<?>> codec = codecProvider.codecFor(schema.getType());
+ String text = xmlElement.getTextContent();
+ Object value = null;
+ if (codec != null) {
+ logger.debug("toSimpleNodeWithType: found codec, deserializing text {}", text);
+ value = codec.deserialize(text);
+ }
+
+ final TypeDefinition<?> baseType = XmlUtils.resolveBaseTypeFrom(schema.getType());
+ if (baseType instanceof org.opendaylight.yangtools.yang.model.util.InstanceIdentifier) {
+ logger.debug("toSimpleNodeWithType: base type of node is instance identifier, deserializing element", xmlElement);
+ value = InstanceIdentifierForXmlCodec.deserialize(xmlElement,schemaCtx);
+
+ } else if(baseType instanceof IdentityrefTypeDefinition){
+ logger.debug("toSimpleNodeWithType: base type of node is IdentityrefTypeDefinition, deserializing element", xmlElement);
+ value = InstanceIdentifierForXmlCodec.toIdentity(xmlElement.getTextContent(), xmlElement, schemaCtx);
+
+ }
+
+ if (value == null) {
+ logger.debug("toSimpleNodeWithType: no type found for element, returning just the text string value of element {}", xmlElement);
+ value = xmlElement.getTextContent();
+ }
+
+ Optional<ModifyAction> modifyAction = getModifyOperationFromAttributes(xmlElement);
+ return new SimpleNodeTOImpl<>(schema.getQName(), null, value, modifyAction.orNull());
+ }
+
+ private static Node<?> toSimpleNodeWithType(final Element xmlElement, final LeafListSchemaNode schema,
+ final XmlCodecProvider codecProvider,final SchemaContext schemaCtx) {
+ TypeDefinitionAwareCodec<? extends Object, ? extends TypeDefinition<?>> codec = codecProvider.codecFor(schema.getType());
+ String text = xmlElement.getTextContent();
+ Object value = null;
+ if (codec != null) {
+ logger.debug("toSimpleNodeWithType: found codec, deserializing text {}", text);
+ value = codec.deserialize(text);
+ }
+
+ if (schema.getType() instanceof org.opendaylight.yangtools.yang.model.util.InstanceIdentifier) {
+ logger.debug("toSimpleNodeWithType: base type of node is instance identifier, deserializing element", xmlElement);
+ value = InstanceIdentifierForXmlCodec.deserialize(xmlElement,schemaCtx);
+ }
+
+ if (value == null) {
+ logger.debug("toSimpleNodeWithType: no type found for element, returning just the text string value of element {}", xmlElement);
+ value = xmlElement.getTextContent();
+ }
+
+ Optional<ModifyAction> modifyAction = getModifyOperationFromAttributes(xmlElement);
+ return new SimpleNodeTOImpl<>(schema.getQName(), null, value, modifyAction.orNull());
+ }
+
+ private static Node<?> toCompositeNodeWithSchema(final Element xmlElement, final QName qName, final DataNodeContainer schema,
+ final SchemaContext schemaCtx) {
+ List<Node<?>> values = toDomNodes(xmlElement, Optional.fromNullable(schema.getChildNodes()),schemaCtx);
+ Optional<ModifyAction> modifyAction = getModifyOperationFromAttributes(xmlElement);
+ return ImmutableCompositeNode.create(qName, values, modifyAction.orNull());
+ }
+
+ private static Optional<ModifyAction> getModifyOperationFromAttributes(final Element xmlElement) {
+ Attr attributeNodeNS = xmlElement.getAttributeNodeNS(OPERATION_ATTRIBUTE_QNAME.getNamespace().toString(), OPERATION_ATTRIBUTE_QNAME.getLocalName());
+ if(attributeNodeNS == null) {
+ return Optional.absent();
+ }
+
+ ModifyAction action = ModifyAction.fromXmlValue(attributeNodeNS.getValue());
+ Preconditions.checkArgument(action.isOnElementPermitted(), "Unexpected operation %s on %s", action, xmlElement);
+
+ return Optional.of(action);
+ }
+
+ private static void checkQName(final Element xmlElement, final QName qName) {
+ checkState(Objects.equal(xmlElement.getNamespaceURI(), qName.getNamespace().toString()));
+ checkState(qName.getLocalName().equals(xmlElement.getLocalName()));
+ }
+
+ public static final Optional<DataSchemaNode> findFirstSchema(final QName qname, final Collection<DataSchemaNode> dataSchemaNode) {
+ if (dataSchemaNode != null && !dataSchemaNode.isEmpty() && qname != null) {
+ for (DataSchemaNode dsn : dataSchemaNode) {
+ if (qname.isEqualWithoutRevision(dsn.getQName())) {
+ return Optional.<DataSchemaNode> of(dsn);
+ } else if (dsn instanceof ChoiceNode) {
+ for (ChoiceCaseNode choiceCase : ((ChoiceNode) dsn).getCases()) {
+ Optional<DataSchemaNode> foundDsn = findFirstSchema(qname, choiceCase.getChildNodes());
+ if (foundDsn != null && foundDsn.isPresent()) {
+ return foundDsn;
+ }
+ }
+ }
+ }
+ }
+ return Optional.absent();
+ }
+
+ private static Node<?> toDomNode(Element element) {
+ QName qname = qNameFromElement(element);
+
+ ImmutableList.Builder<Node<?>> values = ImmutableList.<Node<?>> builder();
+ NodeList nodes = element.getChildNodes();
+ boolean isSimpleObject = true;
+ String value = null;
+ for (int i = 0; i < nodes.getLength(); i++) {
+ org.w3c.dom.Node child = nodes.item(i);
+ if (child instanceof Element) {
+ isSimpleObject = false;
+ values.add(toDomNode((Element) child));
+ }
+ if (isSimpleObject && child instanceof org.w3c.dom.Text) {
+ value = element.getTextContent();
+ if (!Strings.isNullOrEmpty(value)) {
+ isSimpleObject = true;
+ }
+ }
+ }
+ if (isSimpleObject) {
+ return new SimpleNodeTOImpl<>(qname, null, value);
+ }
+ return ImmutableCompositeNode.create(qname, values.build());
+ }
+
+ public static List<Node<?>> toDomNodes(final Element element, final Optional<Collection<DataSchemaNode>> context,SchemaContext schemaCtx) {
+ return forEachChild(element.getChildNodes(),schemaCtx, new Function<ElementWithSchemaContext, Optional<Node<?>>>() {
+
+ @Override
+ public Optional<Node<?>> apply(ElementWithSchemaContext input) {
+ if (context.isPresent()) {
+ QName partialQName = qNameFromElement(input.getElement());
+ Optional<DataSchemaNode> schemaNode = XmlDocumentUtils.findFirstSchema(partialQName, context.get());
+ if (schemaNode.isPresent()) {
+ return Optional.<Node<?>> fromNullable(//
+ toNodeWithSchema(input.getElement(), schemaNode.get(), XmlDocumentUtils.defaultValueCodecProvider(),input.getSchemaContext()));
+ }
+ }
+ return Optional.<Node<?>> fromNullable(toDomNode(input.getElement()));
+ }
+
+ });
+
+ }
+
+ private static final <T> List<T> forEachChild(final NodeList nodes, final SchemaContext schemaContext, final Function<ElementWithSchemaContext, Optional<T>> forBody) {
+ final int l = nodes.getLength();
+ if (l == 0) {
+ return ImmutableList.of();
+ }
+
+ final List<T> list = new ArrayList<>(l);
+ for (int i = 0; i < l; i++) {
+ org.w3c.dom.Node child = nodes.item(i);
+ if (child instanceof Element) {
+ Optional<T> result = forBody.apply(new ElementWithSchemaContext((Element) child,schemaContext));
+ if (result.isPresent()) {
+ list.add(result.get());
+ }
+ }
+ }
+ return ImmutableList.copyOf(list);
+ }
+
+ public static final XmlCodecProvider defaultValueCodecProvider() {
+ return XmlUtils.DEFAULT_XML_CODEC_PROVIDER;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.remote.rpc.utils;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
+import org.opendaylight.yangtools.yang.data.impl.schema.SchemaUtils;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.net.URI;
+import java.util.Map.Entry;
+
+/**
+ * Utility class for bridging JAXP Stream and YANG Data APIs. Note that the definition of this class
+ * by no means final and subject to change as more functionality is centralized here.
+ */
+@Beta
+public class XmlStreamUtils {
+ private static final Logger LOG = LoggerFactory.getLogger(XmlStreamUtils.class);
+ private final XmlCodecProvider codecProvider;
+
+ protected XmlStreamUtils(final XmlCodecProvider codecProvider) {
+ this.codecProvider = Preconditions.checkNotNull(codecProvider);
+ }
+
+ /**
+ * Create a new instance encapsulating a particular codec provider.
+ *
+ * @param codecProvider XML codec provider
+ * @return A new instance
+ */
+ public static XmlStreamUtils create(final XmlCodecProvider codecProvider) {
+ return new XmlStreamUtils(codecProvider);
+ }
+
+ /**
+ * Check if a particular data element can be emitted as an empty element, bypassing value encoding. This
+ * functionality is optional, as valid XML stream is produced even if start/end element is produced unconditionally.
+ *
+ * @param data Data node
+ * @return True if the data node will result in empty element body.
+ */
+ public static boolean isEmptyElement(final Node<?> data) {
+ if (data == null) {
+ return true;
+ }
+
+ if (data instanceof CompositeNode) {
+ return ((CompositeNode) data).getValue().isEmpty();
+ }
+ if (data instanceof SimpleNode) {
+ return data.getValue() == null;
+ }
+
+ // Safe default
+ return false;
+ }
+
+ /**
+ * Write an InstanceIdentifier into the output stream. Calling corresponding {@link javax.xml.stream.XMLStreamWriter#writeStartElement(String)}
+ * and {@link javax.xml.stream.XMLStreamWriter#writeEndElement()} is the responsibility of the caller.
+ *
+ * @param writer XML Stream writer
+ * @param id InstanceIdentifier
+ * @throws javax.xml.stream.XMLStreamException
+ */
+ public static void write(final @Nonnull XMLStreamWriter writer, final @Nonnull YangInstanceIdentifier id) throws XMLStreamException {
+ Preconditions.checkNotNull(writer, "Writer may not be null");
+ Preconditions.checkNotNull(id, "Variable should contain instance of instance identifier and can't be null");
+ LOG.debug("Writing Instance identifier with Random prefix");
+ final RandomPrefix prefixes = new RandomPrefix();
+ final String str = XmlUtils.encodeIdentifier(prefixes, id);
+
+ for (Entry<URI, String> e: prefixes.getPrefixes()) {
+ writer.writeNamespace(e.getValue(), e.getKey().toString());
+ }
+ LOG.debug("Instance identifier with Random prefix is now {}", str);
+ writer.writeCharacters(str);
+ }
+
+ /**
+ * Write a full XML document corresponding to a CompositeNode into an XML stream writer.
+ *
+ * @param writer XML Stream writer
+ * @param data data node
+ * @param schema corresponding schema node, may be null
+ * @throws javax.xml.stream.XMLStreamException if an encoding problem occurs
+ */
+ public void writeDocument(final @Nonnull XMLStreamWriter writer, final @Nonnull CompositeNode data, final @Nullable SchemaNode schema) throws XMLStreamException {
+ // final Boolean repairing = (Boolean) writer.getProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES);
+ // Preconditions.checkArgument(repairing == true, "XML Stream Writer has to be repairing namespaces");
+
+ writer.writeStartDocument();
+ writeElement(writer, data, schema);
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+
+ /**
+ * Write an element into a XML stream writer. This includes the element start/end tags and
+ * the value of the element.
+ *
+ * @param writer XML Stream writer
+ * @param data data node
+ * @param schema Schema node
+ * @throws javax.xml.stream.XMLStreamException if an encoding problem occurs
+ */
+ public void writeElement(final XMLStreamWriter writer, final @Nonnull Node<?> data, final SchemaNode schema) throws XMLStreamException {
+ final QName qname = data.getNodeType();
+ final String pfx = qname.getPrefix() != null ? qname.getPrefix() : "";
+ final String ns = qname.getNamespace() != null ? qname.getNamespace().toString() : "";
+
+ if (isEmptyElement(data)) {
+ writer.writeEmptyElement(pfx, qname.getLocalName(), ns);
+ return;
+ }
+
+ writer.writeStartElement(pfx, qname.getLocalName(), ns);
+ if (data instanceof AttributesContainer && ((AttributesContainer) data).getAttributes() != null) {
+ for (Entry<QName, String> attribute : ((AttributesContainer) data).getAttributes().entrySet()) {
+ writer.writeAttribute(attribute.getKey().getNamespace().toString(), attribute.getKey().getLocalName(), attribute.getValue());
+ }
+ }
+
+ if (data instanceof SimpleNode<?>) {
+ LOG.debug("writeElement : node is of type SimpleNode");
+ // Simple node
+ if (schema instanceof LeafListSchemaNode) {
+ writeValue(writer, ((LeafListSchemaNode) schema).getType(), data.getValue());
+ } else if (schema instanceof LeafSchemaNode) {
+ writeValue(writer, ((LeafSchemaNode) schema).getType(), data.getValue());
+ } else {
+ Object value = data.getValue();
+ if (value != null) {
+ writer.writeCharacters(String.valueOf(value));
+ }
+ }
+ } else {
+ LOG.debug("writeElement : node is of type CompositeNode");
+ // CompositeNode
+ for (Node<?> child : ((CompositeNode) data).getValue()) {
+ DataSchemaNode childSchema = null;
+ if (schema instanceof DataNodeContainer) {
+ childSchema = SchemaUtils.findFirstSchema(child.getNodeType(), ((DataNodeContainer) schema).getChildNodes()).orNull();
+ if (childSchema == null) {
+ LOG.debug("Probably the data node \"{}\" does not conform to schema", child == null ? "" : child.getNodeType().getLocalName());
+ }
+ }
+
+ writeElement(writer, child, childSchema);
+ }
+ }
+
+ writer.writeEndElement();
+ }
+
+ /**
+ * Write a value into a XML stream writer. This method assumes the start and end of element is
+ * emitted by the caller.
+ *
+ * @param writer XML Stream writer
+ * @param type type definitions
+ * @param value object value
+ * @throws javax.xml.stream.XMLStreamException if an encoding problem occurs
+ */
+ public void writeValue(final @Nonnull XMLStreamWriter writer, final @Nonnull TypeDefinition<?> type, final Object value) throws XMLStreamException {
+ if (value == null) {
+ LOG.debug("Value of {}:{} is null, not encoding it", type.getQName().getNamespace(), type.getQName().getLocalName());
+ return;
+ }
+
+ final TypeDefinition<?> baseType = XmlUtils.resolveBaseTypeFrom(type);
+ if (baseType instanceof IdentityrefTypeDefinition) {
+ write(writer, (IdentityrefTypeDefinition) baseType, value);
+ } else if (baseType instanceof InstanceIdentifierTypeDefinition) {
+ write(writer, (InstanceIdentifierTypeDefinition) baseType, value);
+ } else {
+ final TypeDefinitionAwareCodec<Object, ?> codec = codecProvider.codecFor(baseType);
+ String text;
+ if (codec != null) {
+ try {
+ text = codec.serialize(value);
+ } catch (ClassCastException e) {
+ LOG.error("Provided node value {} did not have type {} required by mapping. Using stream instead.", value, baseType, e);
+ text = String.valueOf(value);
+ }
+ } else {
+ LOG.error("Failed to find codec for {}, falling back to using stream", baseType);
+ text = String.valueOf(value);
+ }
+ writer.writeCharacters(text);
+ }
+ }
+
+ private static void write(final @Nonnull XMLStreamWriter writer, final @Nonnull IdentityrefTypeDefinition type, final @Nonnull Object value) throws XMLStreamException {
+ if (value instanceof QName) {
+ final QName qname = (QName) value;
+ final String prefix;
+ if (qname.getPrefix() != null && !qname.getPrefix().isEmpty()) {
+ prefix = qname.getPrefix();
+ } else {
+ prefix = "x";
+ }
+
+ writer.writeNamespace(prefix, qname.getNamespace().toString());
+ writer.writeCharacters(prefix + ':' + qname.getLocalName());
+ } else {
+ LOG.debug("Value of {}:{} is not a QName but {}", type.getQName().getNamespace(), type.getQName().getLocalName(), value.getClass());
+ writer.writeCharacters(String.valueOf(value));
+ }
+ }
+
+ private static void write(final @Nonnull XMLStreamWriter writer, final @Nonnull InstanceIdentifierTypeDefinition type, final @Nonnull Object value) throws XMLStreamException {
+ if (value instanceof YangInstanceIdentifier) {
+ LOG.debug("Writing InstanceIdentifier object {}", value);
+ write(writer, (YangInstanceIdentifier)value);
+ } else {
+ LOG.debug("Value of {}:{} is not an InstanceIdentifier but {}", type.getQName().getNamespace(), type.getQName().getLocalName(), value.getClass());
+ writer.writeCharacters(String.valueOf(value));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.remote.rpc.utils;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.XmlTreeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
+import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.activation.UnsupportedDataTypeException;
+import javax.annotation.Nonnull;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Common XML-related utility methods, which are not specific to a particular
+ * JAXP API.
+ */
+public class XmlUtils {
+
+ public static final XmlCodecProvider DEFAULT_XML_CODEC_PROVIDER = new XmlCodecProvider() {
+ @Override
+ public TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codecFor(final TypeDefinition<?> baseType) {
+ return TypeDefinitionAwareCodec.from(baseType);
+ }
+ };
+
+ private XmlUtils() {
+ }
+
+ private static final String BLANK = "";
+ private static final Logger LOG = LoggerFactory.getLogger(XmlUtils.class);
+
+ /**
+ * Converts the composite node to xml using rpc input schema node
+ * @param cNode
+ * @param schemaContext
+ * @return xml String
+ */
+ public static String inputCompositeNodeToXml(CompositeNode cNode, SchemaContext schemaContext){
+ LOG.debug("Converting input composite node to xml {}", cNode);
+ if (cNode == null) return BLANK;
+
+ if(schemaContext == null) return BLANK;
+
+ Document domTree = null;
+ try {
+ Set<RpcDefinition> rpcs = schemaContext.getOperations();
+ for(RpcDefinition rpc : rpcs) {
+ if(rpc.getQName().equals(cNode.getNodeType())){
+ LOG.debug("Found the rpc definition from schema context matching with input composite node {}", rpc.getQName());
+
+ CompositeNode inputContainer = cNode.getFirstCompositeByName(QName.create(cNode.getNodeType(), "input"));
+ domTree = XmlDocumentUtils.toDocument(inputContainer, rpc.getInput(), XmlDocumentUtils.defaultValueCodecProvider());
+
+ LOG.debug("input composite node to document conversion complete, document is {}", domTree);
+ break;
+ }
+ }
+
+ } catch (UnsupportedDataTypeException e) {
+ LOG.error("Error during translation of CompositeNode to Document", e);
+ }
+ return domTransformer(domTree);
+ }
+
+ /**
+ * Converts the composite node to xml String using rpc output schema node
+ * @param cNode
+ * @param schemaContext
+ * @return xml string
+ */
+ public static String outputCompositeNodeToXml(CompositeNode cNode, SchemaContext schemaContext){
+ LOG.debug("Converting output composite node to xml {}", cNode);
+ if (cNode == null) return BLANK;
+
+ if(schemaContext == null) return BLANK;
+
+ Document domTree = null;
+ try {
+ Set<RpcDefinition> rpcs = schemaContext.getOperations();
+ for(RpcDefinition rpc : rpcs) {
+ if(rpc.getQName().equals(cNode.getNodeType())){
+ LOG.debug("Found the rpc definition from schema context matching with output composite node {}", rpc.getQName());
+
+ CompositeNode outputContainer = cNode.getFirstCompositeByName(QName.create(cNode.getNodeType(), "output"));
+ domTree = XmlDocumentUtils.toDocument(outputContainer, rpc.getOutput(), XmlDocumentUtils.defaultValueCodecProvider());
+
+ LOG.debug("output composite node to document conversion complete, document is {}", domTree);
+ break;
+ }
+ }
+
+ } catch (UnsupportedDataTypeException e) {
+ LOG.error("Error during translation of CompositeNode to Document", e);
+ }
+ return domTransformer(domTree);
+ }
+
+ private static String domTransformer(Document domTree) {
+ StringWriter writer = new StringWriter();
+ try {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer transformer = tf.newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.transform(new DOMSource(domTree), new StreamResult(writer));
+ } catch (TransformerException e) {
+
+ LOG.error("Error during translation of Document to OutputStream", e);
+ }
+ LOG.debug("Document to string conversion complete, xml string is {} ", writer.toString());
+
+ return writer.toString();
+ }
+
+ public static CompositeNode xmlToCompositeNode(String xml){
+ if (xml==null || xml.length()==0) return null;
+
+ Node<?> dataTree;
+ try {
+ dataTree = XmlTreeBuilder.buildDataTree(new ByteArrayInputStream(xml.getBytes()));
+ } catch (XMLStreamException e) {
+ LOG.error("Error during building data tree from XML", e);
+ return null;
+ }
+ if (dataTree == null) {
+ LOG.error("data tree is null");
+ return null;
+ }
+ if (dataTree instanceof SimpleNode) {
+ LOG.error("RPC XML was resolved as SimpleNode");
+ return null;
+ }
+ return (CompositeNode) dataTree;
+ }
+
+ /**
+ * Converts the xml to composite node using rpc input schema node
+ * @param rpc
+ * @param xml
+ * @param schemaContext
+ * @return CompositeNode object based on the input, if any of the input parameter is null, a null object is returned
+ */
+ public static CompositeNode inputXmlToCompositeNode(QName rpc, String xml, SchemaContext schemaContext){
+ LOG.debug("Converting input xml to composite node {}", xml);
+ if (xml==null || xml.length()==0) return null;
+
+ if(rpc == null) return null;
+
+ if(schemaContext == null) return null;
+
+ CompositeNode compositeNode = null;
+ try {
+
+ Document doc = XmlUtil.readXmlToDocument(xml);
+ Set<RpcDefinition> rpcs = schemaContext.getOperations();
+ for(RpcDefinition rpcDef : rpcs) {
+ if(rpcDef.getQName().equals(rpc)){
+ LOG.debug("found the rpc definition from schema context matching rpc {}", rpc);
+
+ if(rpcDef.getInput() == null) {
+ LOG.warn("found rpc definition's input is null");
+ return null;
+ }
+
+ QName input = rpcDef.getInput().getQName();
+ NodeList nodeList = doc.getElementsByTagNameNS(input.getNamespace().toString(), "input");
+ if(nodeList == null || nodeList.getLength() < 1) {
+ LOG.warn("xml does not have input entry. {}", xml);
+ return null;
+ }
+ Element xmlData = (Element)nodeList.item(0);
+
+ List<Node<?>> dataNodes = XmlDocumentUtils.toDomNodes(xmlData,
+ Optional.of(rpcDef.getInput().getChildNodes()), schemaContext);
+
+ LOG.debug("Converted xml input to list of nodes {}", dataNodes);
+
+ final CompositeNodeBuilder<ImmutableCompositeNode> it = ImmutableCompositeNode.builder();
+ it.setQName(input);
+ it.add(ImmutableCompositeNode.create(input, dataNodes));
+ compositeNode = it.toInstance();
+ break;
+ }
+ }
+ } catch (SAXException e) {
+ LOG.error("Error during building data tree from XML", e);
+ } catch (IOException e) {
+ LOG.error("Error during building data tree from XML", e);
+ }
+
+ LOG.debug("Xml to composite node conversion complete {} ", compositeNode);
+ return compositeNode;
+ }
+
+ public static TypeDefinition<?> resolveBaseTypeFrom(final @Nonnull TypeDefinition<?> type) {
+ TypeDefinition<?> superType = type;
+ while (superType.getBaseType() != null) {
+ superType = superType.getBaseType();
+ }
+ return superType;
+ }
+
+ /**
+ * This code is picked from yangtools and modified to add type of instance identifier
+ * output of instance identifier something like below for a flow ref composite node of type instance identifier,
+ * which has path arguments with predicates, whose value is of type java.lang.short
+ * <flow-ref xmlns:bgkj="urn:opendaylight:flow:inventory" xmlns:jdlk="urn:opendaylight:inventory">
+ * /jdlk:nodes/jdlk:node[jdlk:id='openflow:205558455098190@java.lang.String']
+ * /bgkj:table[bgkj:id='3@java.lang.Short']
+ * /bgkj:flow[bgkj:id='156@java.lang.String']
+ * </flow-ref>
+ *
+ */
+
+ public static String encodeIdentifier(final RandomPrefix prefixes, final YangInstanceIdentifier id) {
+ StringBuilder textContent = new StringBuilder();
+ for (PathArgument pathArgument : id.getPathArguments()) {
+ textContent.append('/');
+ textContent.append(prefixes.encodeQName(pathArgument.getNodeType()));
+ if (pathArgument instanceof NodeIdentifierWithPredicates) {
+ Map<QName, Object> predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues();
+
+ for (QName keyValue : predicates.keySet()) {
+ Object value = predicates.get(keyValue);
+ String type = value.getClass().getName();
+ String predicateValue = String.valueOf(value);
+ textContent.append('[');
+ textContent.append(prefixes.encodeQName(keyValue));
+ textContent.append("='");
+ textContent.append(predicateValue);
+ textContent.append("@");
+ textContent.append(type);
+ textContent.append("']");
+ }
+ } else if (pathArgument instanceof NodeWithValue) {
+ textContent.append("[.='");
+ textContent.append(((NodeWithValue) pathArgument).getValue());
+ textContent.append("']");
+ }
+ }
+
+ return textContent.toString();
+ }
+}
remote {
log-remote-lifecycle-events = off
netty.tcp {
- hostname = "192.168.141.142"
+ hostname = "192.168.141.141"
port = 2551
}
}
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
import org.opendaylight.yangtools.yang.data.api.ModifyAction;
import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
Broker.ProviderSession brokerSession = Mockito.mock(Broker.ProviderSession.class);
SchemaContext schemaContext = mock(SchemaContext.class);
ActorRef rpcBroker = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext));
- QName rpc = new QName(new URI("actor1"), "actor1");
- InvokeRpc invokeMsg = new InvokeRpc(rpc, null);
+ QName rpc = new QName(new URI("noactor1"), "noactor1");
+ CompositeNode input = new ImmutableCompositeNode(QName.create("ns", "2013-12-09", "no child"), new ArrayList<Node<?>>(), ModifyAction.REPLACE);
+ InvokeRpc invokeMsg = new InvokeRpc(rpc, input);
rpcBroker.tell(invokeMsg, getRef());
Boolean getMsg = new ExpectMsg<Boolean>("ErrorResponse") {
protected Boolean match(Object in) {
if (in instanceof ErrorResponse) {
ErrorResponse reply = (ErrorResponse)in;
- return "No remote actor found for rpc execution.".equals(reply.getException().getMessage());
+ return reply.getException().getMessage().contains("No remote actor found for rpc execution of :");
} else {
throw noMatch();
}
SchemaContext schemaContext = mock(SchemaContext.class);
ActorRef rpcBroker = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext));
QName rpc = new QName(new URI("actor1"), "actor1");
- InvokeRoutedRpc invokeMsg = new InvokeRoutedRpc(rpc, null);
+ CompositeNode input = new ImmutableCompositeNode(QName.create("ns", "2013-12-09", "child1"), new ArrayList<Node<?>>(), ModifyAction.REPLACE);
+ InvokeRoutedRpc invokeMsg = new InvokeRoutedRpc(rpc, YangInstanceIdentifier.create(new YangInstanceIdentifier.NodeIdentifier(rpc)), input);
rpcBroker.tell(invokeMsg, getRef());
Boolean getMsg = new ExpectMsg<Boolean>("ErrorResponse") {
ActorRef rpcBrokerRemote = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext), "actor2");
// Add Routed RPC in table
QName rpc = new QName(new URI("actor2"), "actor2");
- RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, rpc, null);
+ YangInstanceIdentifier identifier = YangInstanceIdentifier.create(new YangInstanceIdentifier.NodeIdentifier(rpc));
+ RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, rpc, identifier);
final String route = rpcBrokerRemote.path().toString();
Set<RpcRouter.RouteIdentifier<?, ?, ?>> routeIds = new HashSet<>();
routeIds.add(routeId);
RpcResult<CompositeNode> result = Rpcs.getRpcResult(true, invokeRpcResult, errors);
Future<RpcResult<CompositeNode>> rpcResult = Futures.immediateFuture(result);
when(brokerSession.rpc(rpc, input)).thenReturn(rpcResult);
- InvokeRoutedRpc invokeMsg = new InvokeRoutedRpc(rpc, input);
+ InvokeRoutedRpc invokeMsg = new InvokeRoutedRpc(rpc, identifier, input);
rpcBroker.tell(invokeMsg, getRef());
//verify response msg
@Test
public void addGlobalRouteNullRouteTest() {
try {
- RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, null, null);
+ QName type = new QName(new URI("actor1"), "actor1");
+ RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
routingTable.addGlobalRoute(routeId, null);
Assert.fail("Null pointer exception was not thrown.");
@Test
public void addRoutedRpcNullRouteTest() {
try {
- RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, null, null);
+ QName type = new QName(new URI("actor1"), "actor1");
+ RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
routingTable.addRoutedRpc(routeId, null);
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.remote.rpc.utils;
+
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.common.io.ByteSource;
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.ModifyAction;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+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.parser.impl.YangParserImpl;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class XmlUtilsTest {
+
+ private static final DocumentBuilderFactory BUILDERFACTORY;
+
+ static {
+ final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setCoalescing(true);
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setIgnoringComments(true);
+ BUILDERFACTORY = factory;
+ }
+
+ private SchemaContext schema;
+ private RpcDefinition testRpc;
+
+ public static final String XML_CONTENT = "<add-flow xmlns=\"urn:opendaylight:controller:rpc:test\"><input xmlns=\"urn:opendaylight:controller:rpc:test\">" +
+ "<id>flowid</id>" +
+ "<flow xmlns:ltha=\"urn:opendaylight:controller:rpc:test\">/ltha:node/ltha:node1[ltha:id='3@java.lang.Short']</flow>" +
+ "</input></add-flow>";
+
+ @Before
+ public void setUp() throws Exception {
+ final ByteSource byteSource = new ByteSource() {
+ @Override
+ public InputStream openStream() throws IOException {
+ return XmlUtilsTest.this.getClass().getResourceAsStream("rpcTest.yang");
+ }
+ };
+ schema = new YangParserImpl().parseSources(Lists.newArrayList(byteSource));
+ final Module rpcTestModule = schema.getModules().iterator().next();
+ testRpc = rpcTestModule.getRpcs().iterator().next();
+ }
+
+ @Test
+ public void testNullInputXmlToComposite() {
+ CompositeNode node = XmlUtils.inputXmlToCompositeNode(testRpc.getQName(), null, schema);
+ Assert.assertNull(node);
+ }
+
+ @Test
+ public void testNullRpcXmlToComposite() {
+ CompositeNode node = XmlUtils.inputXmlToCompositeNode(null, XML_CONTENT, schema);
+ Assert.assertNull(node);
+ }
+
+ @Test
+ public void testInputXmlToCompositeNode() {
+ CompositeNode node = XmlUtils.inputXmlToCompositeNode(testRpc.getQName(), XML_CONTENT, schema);
+ ImmutableList<SimpleNode> input = (ImmutableList)node.getValue().get(0).getValue();
+ SimpleNode firstNode = input.get(0);
+
+ Assert.assertEquals("id", firstNode.getNodeType().getLocalName());
+ Assert.assertEquals("flowid", firstNode.getValue());
+
+ SimpleNode secondNode = input.get(1);
+ Assert.assertEquals("flow", secondNode.getNodeType().getLocalName());
+
+ YangInstanceIdentifier instance = (YangInstanceIdentifier) secondNode.getValue();
+ Iterable<YangInstanceIdentifier.PathArgument> iterable = instance.getPathArguments();
+ Iterator it = iterable.iterator();
+ YangInstanceIdentifier.NodeIdentifier firstPath = (YangInstanceIdentifier.NodeIdentifier) it.next();
+ Assert.assertEquals("node", firstPath.getNodeType().getLocalName());
+ YangInstanceIdentifier.NodeIdentifierWithPredicates secondPath = (YangInstanceIdentifier.NodeIdentifierWithPredicates)it.next();
+ Short value = (Short)secondPath.getKeyValues().values().iterator().next();
+ Short expected = 3;
+ Assert.assertEquals(expected, value);
+ }
+
+ @Test
+ public void testInputCompositeNodeToXML() {
+ CompositeNode input = XmlUtils.inputXmlToCompositeNode(testRpc.getQName(), XML_CONTENT, schema);
+ List<Node<?>> childNodes = new ArrayList();
+ childNodes.add(input);
+ QName rpcQName = schema.getOperations().iterator().next().getQName();
+ CompositeNode node = new ImmutableCompositeNode(rpcQName, input.getValue(), ModifyAction.REPLACE);
+ String xml = XmlUtils.inputCompositeNodeToXml(node, schema);
+ Assert.assertNotNull(xml);
+ Assert.assertTrue(xml.contains("3@java.lang.Short"));
+ }
+
+ @Test
+ public void testNullCompositeNodeToXml(){
+ String xml = XmlUtils.inputCompositeNodeToXml(null, schema);
+ Assert.assertTrue(xml.isEmpty());
+ }
+
+ @Test
+ public void testNullSchemaCompositeNodeToXml(){
+ String xml = XmlUtils.inputCompositeNodeToXml(new ImmutableCompositeNode(QName.create("ns", "2013-12-09", "child1"), new ArrayList<Node<?>>(), ModifyAction.REPLACE), null);
+ Assert.assertTrue(xml.isEmpty());
+ }
+
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+module rpc-test {
+ yang-version 1;
+ namespace "urn:opendaylight:controller:rpc:test";
+ prefix "rpct";
+
+ revision 2014-07-29 {
+ description "rpc test";
+ }
+
+ typedef flow-ref {
+ type instance-identifier;
+ }
+
+ rpc add-flow {
+ input {
+ leaf id {
+ type string;
+ }
+
+ leaf flow {
+ type flow-ref;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-parent</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>sal-rest-connector-config</artifactId>
+ <description>Configuration files for sal-rest-connector</description>
+ <packaging>jar</packaging>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+ <configuration>
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <!-- default OF-switch-connection-provider (port 6633) -->
+ <module>
+ <type xmlns:rest="urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector">rest:rest-connector-impl</type>
+ <name>rest-connector-default-impl</name>
+ <websocket-port>8181</websocket-port>
+ <dom-broker>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
+ <name>dom-broker</name>
+ </dom-broker>
+ </module>
+ </modules>
+
+ <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <service>
+ <type xmlns:rest="urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector">rest:rest-connector</type>
+ <instance>
+ <name>rest-connector-default</name>
+ <provider>
+ /modules/module[type='rest-connector-impl'][name='rest-connector-default-impl']
+ </provider>
+ </instance>
+ </service>
+ </services>
+ </data>
+ </configuration>
+</snapshot>
<groupId>${project.groupId}</groupId>
<artifactId>sal-core-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sal-binding-config</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-api</artifactId>
+ </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>ietf-yang-types-20130715</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-spi</artifactId>
+ </dependency>
</dependencies>
<build>
<Bundle-Name>MD SAL Restconf Connector</Bundle-Name>
<Private-Package>org.opendaylight.controller.sal.rest.*,
org.opendaylight.controller.sal.restconf.rpc.*,
- org.opendaylight.controller.sal.restconf.impl,</Private-Package>
+ org.opendaylight.controller.sal.restconf.impl,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.rest.connector.rev140724.*,
+ </Private-Package>
<Import-Package>*,
com.sun.jersey.spi.container.servlet</Import-Package>
- <Bundle-Activator>org.opendaylight.controller.sal.rest.impl.RestconfProvider</Bundle-Activator>
<Web-ContextPath>/restconf</Web-ContextPath>
</instructions>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>config</id>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+ <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+ <additionalConfiguration>
+ <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+ </additionalConfiguration>
+ </generator>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<scm>
--- /dev/null
+package org.opendaylight.controller.config.yang.md.sal.rest.connector;
+
+import org.opendaylight.controller.sal.rest.impl.RestconfProviderImpl;
+
+public class RestConnectorModule extends org.opendaylight.controller.config.yang.md.sal.rest.connector.AbstractRestConnectorModule {
+
+ public RestConnectorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public RestConnectorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.md.sal.rest.connector.RestConnectorModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ // Create an instance of our provider
+ RestconfProviderImpl instance = new RestconfProviderImpl();
+ // Set its port
+ instance.setWebsocketPort(getWebsocketPort());
+ // Register it with the Broker
+ getDomBrokerDependency().registerProvider(instance);
+ return instance;
+ }
+}
--- /dev/null
+/*
+* Generated file
+*
+* Generated from: yang module name: opendaylight-rest-connector yang module local name: rest-connector-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Jul 25 04:33:31 CDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.rest.connector;
+
+
+public class RestConnectorModuleFactory extends org.opendaylight.controller.config.yang.md.sal.rest.connector.AbstractRestConnectorModuleFactory {
+
+}
--- /dev/null
+package org.opendaylight.controller.sal.rest.api;
+
+/*
+ * This is a simple dummy interface to allow us to create instances of RestconfProvider
+ * via the config subsystem.
+ */
+public interface RestConnector {
+
+}
import org.opendaylight.controller.sal.restconf.impl.RestCodec;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
writeStringRepresentation(writer, node, baseType, QName.class);
}
} else if (baseType instanceof InstanceIdentifierTypeDefinition) {
- if (node.getValue() instanceof InstanceIdentifier) {
+ if (node.getValue() instanceof YangInstanceIdentifier) {
IdentityValuesDTO valueDTO = (IdentityValuesDTO) RestCodec.from(baseType, mountPoint).serialize(
node.getValue());
writeIdentityValuesDTOToJson(writer, valueDTO);
} else {
- writeStringRepresentation(writer, node, baseType, InstanceIdentifier.class);
+ writeStringRepresentation(writer, node, baseType, YangInstanceIdentifier.class);
}
} else if (baseType instanceof DecimalTypeDefinition || baseType instanceof IntegerTypeDefinition
|| baseType instanceof UnsignedIntegerTypeDefinition) {
import java.util.Collection;
import java.util.Collections;
-import org.opendaylight.controller.sal.core.api.Broker;
+
import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
import org.opendaylight.controller.sal.core.api.Provider;
import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.controller.sal.core.api.mount.MountService;
+import org.opendaylight.controller.sal.rest.api.RestConnector;
import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.streams.websockets.WebSocketServer;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-public class RestconfProvider implements BundleActivator, Provider, ServiceTrackerCustomizer<Broker, Broker> {
+public class RestconfProviderImpl implements Provider, AutoCloseable, RestConnector {
public final static String NOT_INITALIZED_MSG = "Restconf is not initialized yet. Please try again later";
private ListenerRegistration<SchemaServiceListener> listenerRegistration;
- private ServiceTracker<Broker, Broker> brokerServiceTrancker;
- private BundleContext bundleContext;
+ private PortNumber port;
+ public void setWebsocketPort(PortNumber port) {
+ this.port = port;
+ }
+
private Thread webSocketServerThread;
@Override
listenerRegistration = schemaService.registerSchemaServiceListener(ControllerContext.getInstance());
ControllerContext.getInstance().setSchemas(schemaService.getGlobalContext());
ControllerContext.getInstance().setMountService(session.getService(MountService.class));
- }
- @Override
- public void start(BundleContext context) throws Exception {
- String websocketPortStr = context.getProperty(WebSocketServer.WEBSOCKET_SERVER_CONFIG_PROPERTY);
- int websocketPort = (websocketPortStr != null && !"".equals(websocketPortStr)) ? Integer
- .parseInt(websocketPortStr) : WebSocketServer.DEFAULT_PORT;
- bundleContext = context;
- webSocketServerThread = new Thread(WebSocketServer.createInstance(websocketPort));
- webSocketServerThread.setName("Web socket server");
+ webSocketServerThread = new Thread(WebSocketServer.createInstance(port.getValue().intValue()));
+ webSocketServerThread.setName("Web socket server on port " + port);
webSocketServerThread.start();
- brokerServiceTrancker = new ServiceTracker<>(context, Broker.class, this);
- brokerServiceTrancker.open();
- }
-
- @Override
- public void stop(BundleContext context) {
- if (listenerRegistration != null) {
- try {
- listenerRegistration.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- webSocketServerThread.interrupt();
- brokerServiceTrancker.close();
}
@Override
}
@Override
- public Broker addingService(ServiceReference<Broker> reference) {
- Broker broker = bundleContext.getService(reference);
- broker.registerProvider(this, bundleContext);
- return broker;
- }
-
- @Override
- public void modifiedService(ServiceReference<Broker> reference, Broker service) {
- // NOOP
- }
-
- @Override
- public void removedService(ServiceReference<Broker> reference, Broker service) {
- bundleContext.ungetService(reference);
- BrokerFacade.getInstance().setContext(null);
- BrokerFacade.getInstance().setDataService(null);
- ControllerContext.getInstance().setSchemas(null);
+ public void close() {
+ if (listenerRegistration != null) {
+ listenerRegistration.close();
+ }
+ webSocketServerThread.interrupt();
}
}
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
+public class BrokerFacade implements DataReader<YangInstanceIdentifier, CompositeNode> {
private final static Logger LOG = LoggerFactory.getLogger(BrokerFacade.class);
private final static BrokerFacade INSTANCE = new BrokerFacade();
}
@Override
- public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+ public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
this.checkPreconditions();
LOG.trace("Read Configuration via Restconf: {}", path);
}
public CompositeNode readConfigurationDataBehindMountPoint(final MountInstance mountPoint,
- final InstanceIdentifier path) {
+ final YangInstanceIdentifier path) {
this.checkPreconditions();
LOG.trace("Read Configuration via Restconf: {}", path);
}
@Override
- public CompositeNode readOperationalData(final InstanceIdentifier path) {
+ public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
this.checkPreconditions();
BrokerFacade.LOG.trace("Read Operational via Restconf: {}", path);
}
public CompositeNode readOperationalDataBehindMountPoint(final MountInstance mountPoint,
- final InstanceIdentifier path) {
+ final YangInstanceIdentifier path) {
this.checkPreconditions();
BrokerFacade.LOG.trace("Read Operational via Restconf: {}", path);
return context.rpc(type, payload);
}
- public Future<RpcResult<TransactionStatus>> commitConfigurationDataPut(final InstanceIdentifier path,
+ public Future<RpcResult<TransactionStatus>> commitConfigurationDataPut(final YangInstanceIdentifier path,
final CompositeNode payload) {
this.checkPreconditions();
}
public Future<RpcResult<TransactionStatus>> commitConfigurationDataPutBehindMountPoint(
- final MountInstance mountPoint, final InstanceIdentifier path, final CompositeNode payload) {
+ final MountInstance mountPoint, final YangInstanceIdentifier path, final CompositeNode payload) {
this.checkPreconditions();
final DataModificationTransaction transaction = mountPoint.beginTransaction();
return transaction.commit();
}
- public Future<RpcResult<TransactionStatus>> commitConfigurationDataPost(final InstanceIdentifier path,
+ public Future<RpcResult<TransactionStatus>> commitConfigurationDataPost(final YangInstanceIdentifier path,
final CompositeNode payload) {
this.checkPreconditions();
}
public Future<RpcResult<TransactionStatus>> commitConfigurationDataPostBehindMountPoint(
- final MountInstance mountPoint, final InstanceIdentifier path, final CompositeNode payload) {
+ final MountInstance mountPoint, final YangInstanceIdentifier path, final CompositeNode payload) {
this.checkPreconditions();
final DataModificationTransaction transaction = mountPoint.beginTransaction();
return transaction.commit();
}
- public Future<RpcResult<TransactionStatus>> commitConfigurationDataDelete(final InstanceIdentifier path) {
+ public Future<RpcResult<TransactionStatus>> commitConfigurationDataDelete(final YangInstanceIdentifier path) {
this.checkPreconditions();
return deleteDataAtTarget(path, dataService.beginTransaction());
}
public Future<RpcResult<TransactionStatus>> commitConfigurationDataDeleteBehindMountPoint(
- final MountInstance mountPoint, final InstanceIdentifier path) {
+ final MountInstance mountPoint, final YangInstanceIdentifier path) {
this.checkPreconditions();
return deleteDataAtTarget(path, mountPoint.beginTransaction());
}
- private Future<RpcResult<TransactionStatus>> deleteDataAtTarget(final InstanceIdentifier path,
+ private Future<RpcResult<TransactionStatus>> deleteDataAtTarget(final YangInstanceIdentifier path,
final DataModificationTransaction transaction) {
LOG.info("Delete Configuration via Restconf: {}", path);
CompositeNode redDataAtPath = transaction.readConfigurationData(path);
return;
}
- InstanceIdentifier path = listener.getPath();
+ YangInstanceIdentifier path = listener.getPath();
final ListenerRegistration<DataChangeListener> registration = dataService.registerDataChangeListener(path,
listener);
import com.google.common.base.Function;
import com.google.common.base.Objects;
-import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.BiMap;
-import com.google.common.collect.FluentIterable;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorType;
import org.opendaylight.yangtools.concepts.Codec;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
}
- InstanceIdentifierBuilder builder = InstanceIdentifier.builder();
+ InstanceIdentifierBuilder builder = YangInstanceIdentifier.builder();
Module latestModule = this.getLatestModule(globalSchema, startModule);
InstanceIdWithSchemaNode iiWithSchemaNode = this.collectPathArguments(builder, pathArgs, latestModule, null,
toMountPointIdentifier);
module.getRevision());
}
- public DataNodeContainer getDataNodeContainerFor(final InstanceIdentifier path) {
+ public DataNodeContainer getDataNodeContainerFor(final YangInstanceIdentifier path) {
this.checkPreconditions();
final Iterable<PathArgument> elements = path.getPathArguments();
for (final PathArgument element : elements) {
QName _nodeType = element.getNodeType();
final DataSchemaNode potentialNode = ControllerContext.childByQName(node, _nodeType);
- if (potentialNode == null || !this.isListOrContainer(potentialNode)) {
+ if (potentialNode == null || !ControllerContext.isListOrContainer(potentialNode)) {
return null;
}
node = (DataNodeContainer) potentialNode;
return node;
}
- public String toFullRestconfIdentifier(final InstanceIdentifier path) {
+ public String toFullRestconfIdentifier(final YangInstanceIdentifier path) {
this.checkPreconditions();
final Iterable<PathArgument> elements = path.getPathArguments();
for (final PathArgument element : elements) {
QName _nodeType = element.getNodeType();
final DataSchemaNode potentialNode = ControllerContext.childByQName(node, _nodeType);
- if (!this.isListOrContainer(potentialNode)) {
+ if (!ControllerContext.isListOrContainer(potentialNode)) {
return null;
}
node = ((DataNodeContainer) potentialNode);
ErrorType.APPLICATION, ErrorTag.OPERATION_NOT_SUPPORTED);
}
- final InstanceIdentifier partialPath = builder.toInstance();
+ final YangInstanceIdentifier partialPath = builder.toInstance();
final MountInstance mount = mountService.getMountPoint(partialPath);
if (mount == null) {
LOG.debug("Instance identifier to missing mount point: {}", partialPath);
}
if (returnJustMountPoint) {
- InstanceIdentifier instance = InstanceIdentifier.builder().toInstance();
+ YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount);
}
if (strings.size() == 1) {
- InstanceIdentifier instance = InstanceIdentifier.builder().toInstance();
+ YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount);
}
}
List<String> subList = strings.subList(1, strings.size());
- return this.collectPathArguments(InstanceIdentifier.builder(), subList, moduleBehindMountPoint, mount,
+ return this.collectPathArguments(YangInstanceIdentifier.builder(), subList, moduleBehindMountPoint, mount,
returnJustMountPoint);
}
targetNode = potentialSchemaNodes.iterator().next();
}
- if (!this.isListOrContainer(targetNode)) {
+ if (!ControllerContext.isListOrContainer(targetNode)) {
throw new RestconfDocumentedException("URI has bad format. Node \"" + head
+ "\" must be Container or List yang type.", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
}
private QName toQName(final String name) {
final String module = toModuleName(name);
final String node = toNodeName(name);
- Set<Module> modules = globalSchema.getModules();
-
- final Comparator<Module> comparator = new Comparator<Module>() {
- @Override
- public int compare(final Module o1, final Module o2) {
- return o1.getRevision().compareTo(o2.getRevision());
- }
- };
-
- List<Module> sorted = new ArrayList<Module>(modules);
- Collections.<Module> sort(new ArrayList<Module>(modules), comparator);
-
- final Function<Module, QName> transform = new Function<Module, QName>() {
- @Override
- public QName apply(final Module m) {
- return QName.create(m.getNamespace(), m.getRevision(), m.getName());
- }
- };
-
- final Predicate<QName> findFirst = new Predicate<QName>() {
- @Override
- public boolean apply(final QName qn) {
- return Objects.equal(module, qn.getLocalName());
- }
- };
-
- Optional<QName> namespace = FluentIterable.from(sorted).transform(transform).firstMatch(findFirst);
- return namespace.isPresent() ? QName.create(namespace.get(), node) : null;
+ final Module m = globalSchema.findModuleByName(module, null);
+ return m == null ? null : QName.create(m.getQNameModule(), node);
}
private static boolean isListOrContainer(final DataSchemaNode node) {
package org.opendaylight.controller.sal.restconf.impl;
import org.opendaylight.controller.sal.core.api.mount.MountInstance;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
public class InstanceIdWithSchemaNode {
- private final InstanceIdentifier instanceIdentifier;
+ private final YangInstanceIdentifier instanceIdentifier;
private final DataSchemaNode schemaNode;
private final MountInstance mountPoint;
- public InstanceIdWithSchemaNode(InstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode,
+ public InstanceIdWithSchemaNode(YangInstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode,
MountInstance mountPoint) {
this.instanceIdentifier = instanceIdentifier;
this.schemaNode = schemaNode;
this.mountPoint = mountPoint;
}
- public InstanceIdentifier getInstanceIdentifier() {
+ public YangInstanceIdentifier getInstanceIdentifier() {
return instanceIdentifier;
}
import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.Predicate;
import org.opendaylight.yangtools.concepts.Codec;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.codec.IdentityrefCodec;
import org.opendaylight.yangtools.yang.data.api.codec.InstanceIdentifierCodec;
import org.opendaylight.yangtools.yang.data.api.codec.LeafrefCodec;
}
@Override
- public IdentityValuesDTO serialize(final InstanceIdentifier data) {
+ public IdentityValuesDTO serialize(final YangInstanceIdentifier data) {
IdentityValuesDTO identityValuesDTO = new IdentityValuesDTO();
for (PathArgument pathArgument : data.getPathArguments()) {
IdentityValue identityValue = qNameToIdentityValue(pathArgument.getNodeType());
}
@Override
- public InstanceIdentifier deserialize(final IdentityValuesDTO data) {
+ public YangInstanceIdentifier deserialize(final IdentityValuesDTO data) {
List<PathArgument> result = new ArrayList<PathArgument>();
IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint);
}
}
- return result.isEmpty() ? null : InstanceIdentifier.create(result);
+ return result.isEmpty() ? null : YangInstanceIdentifier.create(result);
}
private List<Predicate> keyValuesToPredicateList(final Map<QName, Object> keyValues) {
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
rpc.getQName(), "path"));
final Object pathValue = pathNode == null ? null : pathNode.getValue();
- if (!(pathValue instanceof InstanceIdentifier)) {
+ if (!(pathValue instanceof YangInstanceIdentifier)) {
throw new RestconfDocumentedException("Instance identifier was not normalized correctly.",
ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED);
}
- final InstanceIdentifier pathIdentifier = ((InstanceIdentifier) pathValue);
+ final YangInstanceIdentifier pathIdentifier = ((YangInstanceIdentifier) pathValue);
String streamName = null;
if (!Iterables.isEmpty(pathIdentifier.getPathArguments())) {
String fullRestconfIdentifier = this.controllerContext.toFullRestconfIdentifier(pathIdentifier);
private InstanceIdWithSchemaNode addLastIdentifierFromData(final InstanceIdWithSchemaNode identifierWithSchemaNode,
final CompositeNode data, final DataSchemaNode schemaOfData) {
- InstanceIdentifier instanceIdentifier = null;
+ YangInstanceIdentifier instanceIdentifier = null;
if (identifierWithSchemaNode != null) {
instanceIdentifier = identifierWithSchemaNode.getInstanceIdentifier();
}
- final InstanceIdentifier iiOriginal = instanceIdentifier;
+ final YangInstanceIdentifier iiOriginal = instanceIdentifier;
InstanceIdentifierBuilder iiBuilder = null;
if (iiOriginal == null) {
- iiBuilder = InstanceIdentifier.builder();
+ iiBuilder = YangInstanceIdentifier.builder();
} else {
- iiBuilder = InstanceIdentifier.builder(iiOriginal);
+ iiBuilder = YangInstanceIdentifier.builder(iiOriginal);
}
if ((schemaOfData instanceof ListSchemaNode)) {
iiBuilder.node(schemaOfData.getQName());
}
- InstanceIdentifier instance = iiBuilder.toInstance();
+ YangInstanceIdentifier instance = iiBuilder.toInstance();
MountInstance mountPoint = null;
if (identifierWithSchemaNode != null) {
mountPoint = identifierWithSchemaNode.getMountPoint();
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final XmlMapper xmlMapper = new XmlMapper();
private final SimpleDateFormat rfc3339 = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZ");
- private final InstanceIdentifier path;
+ private final YangInstanceIdentifier path;
private ListenerRegistration<DataChangeListener> registration;
private final String streamName;
private Set<Channel> subscribers = new ConcurrentSet<>();
* @param streamName
* The name of the stream.
*/
- ListenerAdapter(final InstanceIdentifier path, final String streamName) {
+ ListenerAdapter(final YangInstanceIdentifier path, final String streamName) {
Preconditions.checkNotNull(path);
Preconditions.checkArgument(streamName != null && !streamName.isEmpty());
this.path = path;
}
@Override
- public void onDataChanged(final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+ public void onDataChanged(final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
if (!change.getCreatedConfigurationData().isEmpty() || !change.getCreatedOperationalData().isEmpty()
|| !change.getUpdatedConfigurationData().isEmpty() || !change.getUpdatedOperationalData().isEmpty()
|| !change.getRemovedConfigurationData().isEmpty() || !change.getRemovedOperationalData().isEmpty()) {
* DataChangeEvent
* @return Data in printable form.
*/
- private String prepareXmlFrom(final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+ private String prepareXmlFrom(final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
Document doc = createDocument();
Element notificationElement = doc.createElementNS("urn:ietf:params:xml:ns:netconf:notification:1.0",
"notification");
*/
private void addValuesToDataChangedNotificationEventElement(final Document doc,
final Element dataChangedNotificationEventElement,
- final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+ final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
addValuesFromDataToElement(doc, change.getCreatedConfigurationData(), dataChangedNotificationEventElement,
Store.CONFIG, Operation.CREATED);
addValuesFromDataToElement(doc, change.getCreatedOperationalData(), dataChangedNotificationEventElement,
* @param doc
* {@link Document}
* @param data
- * Set of {@link InstanceIdentifier}.
+ * Set of {@link YangInstanceIdentifier}.
* @param element
* {@link Element}
* @param store
* @param operation
* {@link Operation}
*/
- private void addValuesFromDataToElement(final Document doc, final Set<InstanceIdentifier> data,
+ private void addValuesFromDataToElement(final Document doc, final Set<YangInstanceIdentifier> data,
final Element element, final Store store, final Operation operation) {
if (data == null || data.isEmpty()) {
return;
}
- for (InstanceIdentifier path : data) {
+ for (YangInstanceIdentifier path : data) {
Node node = createDataChangeEventElement(doc, path, null, store, operation);
element.appendChild(node);
}
* @param doc
* {@link Document}
* @param data
- * Map of {@link InstanceIdentifier} and {@link CompositeNode}.
+ * Map of {@link YangInstanceIdentifier} and {@link CompositeNode}.
* @param element
* {@link Element}
* @param store
* @param operation
* {@link Operation}
*/
- private void addValuesFromDataToElement(final Document doc, final Map<InstanceIdentifier, CompositeNode> data,
+ private void addValuesFromDataToElement(final Document doc, final Map<YangInstanceIdentifier, CompositeNode> data,
final Element element, final Store store, final Operation operation) {
if (data == null || data.isEmpty()) {
return;
}
- for (Entry<InstanceIdentifier, CompositeNode> entry : data.entrySet()) {
+ for (Entry<YangInstanceIdentifier, CompositeNode> entry : data.entrySet()) {
Node node = createDataChangeEventElement(doc, entry.getKey(), entry.getValue(), store, operation);
element.appendChild(node);
}
* {@link Operation}
* @return {@link Node} node represented by changed event element.
*/
- private Node createDataChangeEventElement(final Document doc, final InstanceIdentifier path,
+ private Node createDataChangeEventElement(final Document doc, final YangInstanceIdentifier path,
final CompositeNode data, final Store store, final Operation operation) {
Element dataChangeEventElement = doc.createElement("data-change-event");
* {@link CompositeNode}
* @return Data in XML format.
*/
- private Node translateToXml(final InstanceIdentifier path, final CompositeNode data) {
+ private Node translateToXml(final YangInstanceIdentifier path, final CompositeNode data) {
DataNodeContainer schemaNode = ControllerContext.getInstance().getDataNodeContainerFor(path);
if (schemaNode == null) {
LOG.info(
* @param element
* {@link Element}
*/
- private void addPathAsValueToElement(final InstanceIdentifier path, final Element element) {
+ private void addPathAsValueToElement(final YangInstanceIdentifier path, final Element element) {
// Map< key = namespace, value = prefix>
Map<String, String> prefixes = new HashMap<>();
- InstanceIdentifier instanceIdentifier = path;
+ YangInstanceIdentifier instanceIdentifier = path;
StringBuilder textContent = new StringBuilder();
// FIXME: BUG-1281: this is duplicated code from yangtools (BUG-1275)
*
* @return Path pointed to data in data store.
*/
- public InstanceIdentifier getPath() {
+ public YangInstanceIdentifier getPath() {
return path;
}
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
* {@link Notificator} is responsible to create, remove and find {@link ListenerAdapter} listener.
public class Notificator {
private static Map<String, ListenerAdapter> listenersByStreamName = new ConcurrentHashMap<>();
- private static Map<InstanceIdentifier, ListenerAdapter> listenersByInstanceIdentifier = new ConcurrentHashMap<>();
+ private static Map<YangInstanceIdentifier, ListenerAdapter> listenersByInstanceIdentifier = new ConcurrentHashMap<>();
private static final Lock lock = new ReentrantLock();
private Notificator() {
}
/**
- * Gets {@link ListenerAdapter} listener specified by {@link InstanceIdentifier} path.
+ * Gets {@link ListenerAdapter} listener specified by {@link YangInstanceIdentifier} path.
*
* @param path
* Path to data in data repository.
* @return ListenerAdapter
*/
- public static ListenerAdapter getListenerFor(InstanceIdentifier path) {
+ public static ListenerAdapter getListenerFor(YangInstanceIdentifier path) {
return listenersByInstanceIdentifier.get(path);
}
/**
- * Checks if the listener specified by {@link InstanceIdentifier} path exist.
+ * Checks if the listener specified by {@link YangInstanceIdentifier} path exist.
*
* @param path
* Path to data in data repository.
* @return True if the listener exist, false otherwise.
*/
- public static boolean existListenerFor(InstanceIdentifier path) {
+ public static boolean existListenerFor(YangInstanceIdentifier path) {
return listenersByInstanceIdentifier.containsKey(path);
}
/**
- * Creates new {@link ListenerAdapter} listener from {@link InstanceIdentifier} path and stream name.
+ * Creates new {@link ListenerAdapter} listener from {@link YangInstanceIdentifier} path and stream name.
*
* @param path
* Path to data in data repository.
* @param streamName
* The name of the stream.
- * @return New {@link ListenerAdapter} listener from {@link InstanceIdentifier} path and stream name.
+ * @return New {@link ListenerAdapter} listener from {@link YangInstanceIdentifier} path and stream name.
*/
- public static ListenerAdapter createListener(InstanceIdentifier path, String streamName) {
+ public static ListenerAdapter createListener(YangInstanceIdentifier path, String streamName) {
ListenerAdapter listener = new ListenerAdapter(path, streamName);
try {
lock.lock();
}
/**
- * Looks for listener determined by {@link InstanceIdentifier} path and removes it.
+ * Looks for listener determined by {@link YangInstanceIdentifier} path and removes it.
*
* @param path
* InstanceIdentifier
*/
- public static void removeListener(InstanceIdentifier path) {
+ public static void removeListener(YangInstanceIdentifier path) {
ListenerAdapter listener = listenersByInstanceIdentifier.get(path);
deleteListener(listener);
}
--- /dev/null
+module opendaylight-rest-connector {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector";
+ prefix "md-sal-rest-connector";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-dom {prefix dom; revision-date 2013-10-28;}
+ import opendaylight-md-sal-binding {prefix sal; revision-date 2013-10-28;}
+ import ietf-inet-types {prefix inet; revision-date 2010-09-24;}
+
+ description
+ "Service definition for Rest Connector";
+
+ revision "2014-07-24" {
+ description
+ "Initial revision";
+ }
+
+ identity rest-connector {
+ base "config:service-type";
+ config:java-class "org.opendaylight.controller.sal.rest.api.RestConnector";
+ }
+
+ identity rest-connector-impl {
+ base config:module-type;
+ config:provided-service rest-connector;
+ config:java-name-prefix RestConnector;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case rest-connector-impl {
+ when "/config:modules/config:module/config:type = 'rest-connector-impl'";
+ leaf websocket-port {
+ mandatory true;
+ type inet:port-number;
+ }
+ container dom-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity dom:dom-broker-osgi-registry;
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
Builder<TransactionStatus> futureBuilder = new DummyFuture.Builder<TransactionStatus>();
futureBuilder.rpcResult(new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.COMMITED)
.build());
- when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(futureBuilder.build());
}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
/**
QName qname = QName.create("node");
- InstanceIdentifier instanceID = InstanceIdentifier.builder().node(qname).toInstance();
+ YangInstanceIdentifier instanceID = YangInstanceIdentifier.builder().node(qname).toInstance();
@Before
public void setUp() throws Exception {
public void testCommitConfigurationDataPost() {
Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
- Map<InstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<InstanceIdentifier, CompositeNode>()
+ Map<YangInstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<YangInstanceIdentifier, CompositeNode>()
.put(instanceID, dataNode).build();
when(dataBroker.beginTransaction()).thenReturn(mockTransaction);
public void testCommitConfigurationDataPostBehindMountPoint() {
Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
- Map<InstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<InstanceIdentifier, CompositeNode>()
+ Map<YangInstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<YangInstanceIdentifier, CompositeNode>()
.put(instanceID, dataNode).build();
when(mockMountInstance.beginTransaction()).thenReturn(mockTransaction);
Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
when(dataBroker.beginTransaction()).thenReturn(mockTransaction);
- when(mockTransaction.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(
+ when(mockTransaction.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(
ImmutableCompositeNode.builder().toInstance());
mockTransaction.removeConfigurationData(instanceID);
when(mockTransaction.commit()).thenReturn(expFuture);
Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
when(mockMountInstance.beginTransaction()).thenReturn(mockTransaction);
- when(mockTransaction.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(
+ when(mockTransaction.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(
ImmutableCompositeNode.builder().toInstance());
mockTransaction.removeConfigurationData(instanceID);
when(mockTransaction.commit()).thenReturn(expFuture);
import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
}
- private CompositeNode prepareCnSn(final InstanceIdentifier instanceIdentifier) throws URISyntaxException {
+ private CompositeNode prepareCnSn(final YangInstanceIdentifier instanceIdentifier) throws URISyntaxException {
CompositeNodeBuilder<ImmutableCompositeNode> cont = ImmutableCompositeNode.builder();
cont.setQName(QName.create("instance:identifier:module", "2014-01-17", "cont"));
return cont.toInstance();
}
- private InstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
+ private YangInstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
List<PathArgument> pathArguments = new ArrayList<>();
pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont")));
pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1")));
pathArguments.add(new NodeIdentifier(new QName(new URI("augment:augment:module"), "lf112")));
- return InstanceIdentifier.create(pathArguments);
+ return YangInstanceIdentifier.create(pathArguments);
}
- private InstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException {
+ private YangInstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException {
List<PathArgument> pathArguments = new ArrayList<>();
pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont")));
pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1")));
pathArguments.add(new NodeWithValue(new QName(new URI("augment:module:leaf:list"), "lflst11"), "lflst11_1"));
- return InstanceIdentifier.create(pathArguments);
+ return YangInstanceIdentifier.create(pathArguments);
}
}
* string - first argument).
*/
@Test
- public void invokeRpcMtethodTest() {
+ public void invokeRpcMethodTest() {
ControllerContext contContext = controllerContext;
try {
contContext.findModuleNameByNamespace(new URI("invoke:rpc:module"));
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public void deleteConfigStatusCodes() throws UnsupportedEncodingException {
String uri = "/config/test-interface:interfaces";
Future<RpcResult<TransactionStatus>> dummyFuture = createFuture(TransactionStatus.COMMITED);
- when(brokerFacade.commitConfigurationDataDelete(any(InstanceIdentifier.class))).thenReturn(dummyFuture);
+ when(brokerFacade.commitConfigurationDataDelete(any(YangInstanceIdentifier.class))).thenReturn(dummyFuture);
Response response = target(uri).request(MediaType.APPLICATION_XML).delete();
assertEquals(200, response.getStatus());
dummyFuture = createFuture(TransactionStatus.FAILED);
- when(brokerFacade.commitConfigurationDataDelete(any(InstanceIdentifier.class))).thenReturn(dummyFuture);
+ when(brokerFacade.commitConfigurationDataDelete(any(YangInstanceIdentifier.class))).thenReturn(dummyFuture);
response = target(uri).request(MediaType.APPLICATION_XML).delete();
assertEquals(500, response.getStatus());
}
import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
public void getDataWithUrlMountPoint() throws UnsupportedEncodingException, URISyntaxException {
when(
brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
+ any(YangInstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
* Slashes in URI behind mount point. lst1 element with key GigabitEthernet0%2F0%2F0%2F0 (GigabitEthernet0/0/0/0) is
* requested via GET HTTP operation. It is tested whether %2F character is replaced with simple / in
* InstanceIdentifier parameter in method
- * {@link BrokerFacade#readConfigurationDataBehindMountPoint(MountInstance, InstanceIdentifier)} which is called in
+ * {@link BrokerFacade#readConfigurationDataBehindMountPoint(MountInstance, YangInstanceIdentifier)} which is called in
* method {@link RestconfImpl#readConfigurationData}
*
*
@Test
public void getDataWithSlashesBehindMountPoint() throws UnsupportedEncodingException, URISyntaxException,
ParseException {
- InstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
+ YangInstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
when(
brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
eq(awaitedInstanceIdentifier))).thenReturn(prepareCnDataForMountPointTest());
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
assertEquals(200, get(uri, MediaType.APPLICATION_XML));
}
- private InstanceIdentifier prepareInstanceIdentifierForList() throws URISyntaxException, ParseException {
+ private YangInstanceIdentifier prepareInstanceIdentifierForList() throws URISyntaxException, ParseException {
List<PathArgument> parameters = new ArrayList<>();
Date revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-09");
QName qNameList = QName.create(uri, revision, "lst1");
QName qNameKeyList = QName.create(uri, revision, "lf11");
- parameters.add(new InstanceIdentifier.NodeIdentifier(qNameCont));
- parameters.add(new InstanceIdentifier.NodeIdentifierWithPredicates(qNameList, qNameKeyList,
+ parameters.add(new YangInstanceIdentifier.NodeIdentifier(qNameCont));
+ parameters.add(new YangInstanceIdentifier.NodeIdentifierWithPredicates(qNameList, qNameKeyList,
"GigabitEthernet0/0/0/0"));
- return InstanceIdentifier.create(parameters);
+ return YangInstanceIdentifier.create(parameters);
}
@Test
public void getDataMountPointIntoHighestElement() throws UnsupportedEncodingException, URISyntaxException {
when(
brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
+ any(YangInstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
controllerContext.setMountService(mockMountService);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
controllerContext.setMountService(mockMountService);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
controllerContext.setMountService(mockMountService);
}
private void mockReadOperationalDataMethod() {
- when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(answerFromGet);
+ when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
}
private void mockReadConfigurationDataMethod() {
- when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(answerFromGet);
+ when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
}
private static CompositeNode prepareCompositeNodeWithIetfInterfacesInterfacesData() {
toSimpleNodeData(toNestedQName("depth3-leaf2"), "depth3-leaf2-value")),
toSimpleNodeData(toNestedQName("depth2-leaf1"), "depth2-leaf1-value")));
- when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(depth1Cont);
+ when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(depth1Cont);
// Test config with depth 1
toSimpleNodeData(toNestedQName("depth4-leaf1"), "depth4-leaf1-value")),
toSimpleNodeData(toNestedQName("depth3-leaf1"), "depth3-leaf1-value")));
- when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(depth2Cont1);
+ when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(depth2Cont1);
response = target("/operational/nested-module:depth1-cont/depth2-cont1").queryParam("depth", "3")
.request("application/xml").get();
import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
rpcResult).build();
when(
brokerFacade.commitConfigurationDataPostBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+ any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
dummyFuture = new DummyFuture.Builder<TransactionStatus>().build();
}
- when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(dummyFuture);
}
Future<RpcResult<TransactionStatus>> dummyFuture = new DummyFuture.Builder<TransactionStatus>().rpcResult(
rpcResult).build();
- when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(dummyFuture);
- ArgumentCaptor<InstanceIdentifier> instanceIdCaptor = ArgumentCaptor.forClass(InstanceIdentifier.class);
+ ArgumentCaptor<YangInstanceIdentifier> instanceIdCaptor = ArgumentCaptor.forClass(YangInstanceIdentifier.class);
ArgumentCaptor<CompositeNode> compNodeCaptor = ArgumentCaptor.forClass(CompositeNode.class);
String URI_1 = "/config";
public void createConfigurationDataNullTest() throws UnsupportedEncodingException {
initMocking();
- when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(null);
String URI_1 = "/config";
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class RestPutOperationTest extends JerseyTest {
rpcResult).build();
when(
brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+ any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
rpcResult).build();
when(
brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class),
- any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+ any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
MountInstance mountInstance = mock(MountInstance.class);
when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
MountService mockMountService = mock(MountService.class);
- when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
ControllerContext.getInstance().setMountService(mockMountService);
.build();
Future<RpcResult<TransactionStatus>> dummyFuture = new DummyFuture.Builder<TransactionStatus>().rpcResult(
rpcResult).build();
- when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(brokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(dummyFuture);
}
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
CompositeNode loadedCompositeNode = TestUtils.readInputToCnSn("/parts/ietf-interfaces_interfaces.xml",
XmlToCompositeNodeProvider.INSTANCE);
BrokerFacade brokerFacade = mock(BrokerFacade.class);
- when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
+ when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(loadedCompositeNode);
assertEquals(loadedCompositeNode, brokerFacade.readOperationalData(null));
}
import org.opendaylight.controller.sal.restconf.impl.StructuredData;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
controllerContext.setSchemas(TestUtils.loadSchemaContext(modules));
- when(mockedBrokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+ when(mockedBrokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
.thenReturn(
new DummyFuture.Builder().rpcResult(
new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.COMMITED)
import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
} else {
when(mountInstance.getSchemaContext()).thenReturn(null);
}
- when(mountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+ when(mountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
}
}
import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSchemaLoader {
private void verifyLeafListPredicate(CompositeNode cnSn) throws URISyntaxException {
SimpleNode<?> lf11 = getSnWithInstanceIdentifierWhenLeafList(cnSn);
Object value = lf11.getValue();
- assertTrue(value instanceof InstanceIdentifier);
+ assertTrue(value instanceof YangInstanceIdentifier);
- InstanceIdentifier instanceIdentifier = (InstanceIdentifier) value;
+ YangInstanceIdentifier instanceIdentifier = (YangInstanceIdentifier) value;
List<PathArgument> pathArguments = instanceIdentifier.getPath();
assertEquals(3, pathArguments.size());
String revisionDate = "2014-01-17";
private void verifyListPredicate(CompositeNode cnSn) throws URISyntaxException {
SimpleNode<?> lf111 = getSnWithInstanceIdentifierWhenList(cnSn);
Object value = lf111.getValue();
- assertTrue(value instanceof InstanceIdentifier);
+ assertTrue(value instanceof YangInstanceIdentifier);
- InstanceIdentifier instanceIdentifier = (InstanceIdentifier) value;
+ YangInstanceIdentifier instanceIdentifier = (YangInstanceIdentifier) value;
List<PathArgument> pathArguments = instanceIdentifier.getPath();
assertEquals(4, pathArguments.size());
String revisionDate = "2014-01-17";
import org.opendaylight.controller.sal.rest.doc.swagger.Resource;
import org.opendaylight.controller.sal.rest.doc.swagger.ResourceList;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
private static final String DATASTORES_LABEL = "Datastores";
private MountProvisionService mountService;
- private final Map<InstanceIdentifier, Long> instanceIdToLongId = new TreeMap<>(
- new Comparator<InstanceIdentifier>() {
+ private final Map<YangInstanceIdentifier, Long> instanceIdToLongId = new TreeMap<>(
+ new Comparator<YangInstanceIdentifier>() {
@Override
- public int compare(final InstanceIdentifier o1, final InstanceIdentifier o2) {
+ public int compare(final YangInstanceIdentifier o1, final YangInstanceIdentifier o2) {
return o1.toString().compareToIgnoreCase(o2.toString());
}
});
- private final Map<Long, InstanceIdentifier> longIdToInstanceId = new HashMap<>();
+ private final Map<Long, YangInstanceIdentifier> longIdToInstanceId = new HashMap<>();
private final Object lock = new Object();
private final AtomicLong idKey = new AtomicLong(0);
Map<String, Long> urlToId = new HashMap<>();
synchronized (lock) {
SchemaContext context = globalSchema.getGlobalContext();
- for (Entry<InstanceIdentifier, Long> entry : instanceIdToLongId.entrySet()) {
+ for (Entry<YangInstanceIdentifier, Long> entry : instanceIdToLongId.entrySet()) {
String modName = findModuleName(entry.getKey(), context);
urlToId.put(generateUrlPrefixFromInstanceID(entry.getKey(), modName),
entry.getValue());
this.globalSchema = globalSchema;
}
- private String findModuleName(final InstanceIdentifier id, final SchemaContext context) {
+ private String findModuleName(final YangInstanceIdentifier id, final SchemaContext context) {
PathArgument rootQName = id.getPathArguments().iterator().next();
for (Module mod : context.getModules()) {
if (mod.getDataChildByName(rootQName.getNodeType()) != null) {
return null;
}
- private String generateUrlPrefixFromInstanceID(final InstanceIdentifier key, final String moduleName) {
+ private String generateUrlPrefixFromInstanceID(final YangInstanceIdentifier key, final String moduleName) {
StringBuilder builder = new StringBuilder();
if (moduleName != null) {
builder.append(moduleName);
builder.append('/');
}
builder.append(name);
- if (arg instanceof InstanceIdentifier.NodeIdentifierWithPredicates) {
+ if (arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
NodeIdentifierWithPredicates nodeId = (NodeIdentifierWithPredicates) arg;
for (Entry<QName, Object> entry : nodeId.getKeyValues().entrySet()) {
builder.append('/').append(entry.getValue());
return builder.append('/').toString();
}
- private String getYangMountUrl(final InstanceIdentifier key) {
+ private String getYangMountUrl(final YangInstanceIdentifier key) {
String modName = findModuleName(key, globalSchema.getGlobalContext());
return generateUrlPrefixFromInstanceID(key, modName) + "yang-ext:mount/";
}
public ResourceList getResourceList(final UriInfo uriInfo, final Long id) {
- InstanceIdentifier iid = getInstanceId(id);
+ YangInstanceIdentifier iid = getInstanceId(id);
if (iid == null) {
return null; // indicating not found.
}
return list;
}
- private InstanceIdentifier getInstanceId(final Long id) {
- InstanceIdentifier instanceId;
+ private YangInstanceIdentifier getInstanceId(final Long id) {
+ YangInstanceIdentifier instanceId;
synchronized (lock) {
instanceId = longIdToInstanceId.get(id);
}
return instanceId;
}
- private SchemaContext getSchemaContext(final InstanceIdentifier id) {
+ private SchemaContext getSchemaContext(final YangInstanceIdentifier id) {
if (id == null) {
return null;
}
public ApiDeclaration getMountPointApi(final UriInfo uriInfo, final Long id, final String module, final String revision) {
- InstanceIdentifier iid = getInstanceId(id);
+ YangInstanceIdentifier iid = getInstanceId(id);
SchemaContext context = getSchemaContext(iid);
String urlPrefix = getYangMountUrl(iid);
if (context == null) {
}
@Override
- public void onMountPointCreated(final InstanceIdentifier path) {
+ public void onMountPointCreated(final YangInstanceIdentifier path) {
synchronized (lock) {
Long idLong = idKey.incrementAndGet();
instanceIdToLongId.put(path, idLong);
}
@Override
- public void onMountPointRemoved(final InstanceIdentifier path) {
+ public void onMountPointRemoved(final YangInstanceIdentifier path) {
synchronized (lock) {
Long id = instanceIdToLongId.remove(path);
longIdToInstanceId.remove(id);
import org.opendaylight.controller.sal.rest.doc.swagger.Resource;
import org.opendaylight.controller.sal.rest.doc.swagger.ResourceList;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class MountPointSwaggerTest {
private static final String HTTP_URL = "http://localhost/path";
- private static final InstanceIdentifier instanceId = InstanceIdentifier.builder()
+ private static final YangInstanceIdentifier instanceId = YangInstanceIdentifier.builder()
.node(QName.create("nodes"))
.nodeWithKey(QName.create("node"), QName.create("id"), "123").build();
private static final String INSTANCE_URL = "nodes/node/123/";
protected FlowStatsEntry updateSingleStat(final DataModificationTransaction trans, final FlowAndStatisticsMapList map) {
short tableId = map.getTableId();
- FlowBuilder flowBuilder = new FlowBuilder();
-
FlowStatisticsDataBuilder flowStatisticsData = new FlowStatisticsDataBuilder();
- FlowBuilder flow = new FlowBuilder();
- flow.setContainerName(map.getContainerName());
- flow.setBufferId(map.getBufferId());
- flow.setCookie(map.getCookie());
- flow.setCookieMask(map.getCookieMask());
- flow.setFlags(map.getFlags());
- flow.setFlowName(map.getFlowName());
- flow.setHardTimeout(map.getHardTimeout());
- if(map.getFlowId() != null)
+ FlowBuilder flow = new FlowBuilder(map);
+ if(map.getFlowId() != null) {
flow.setId(new FlowId(map.getFlowId().getValue()));
- flow.setIdleTimeout(map.getIdleTimeout());
- flow.setInstallHw(map.isInstallHw());
- flow.setInstructions(map.getInstructions());
- if(map.getFlowId()!= null)
+ }
+ if(map.getFlowId()!= null) {
flow.setKey(new FlowKey(new FlowId(map.getKey().getFlowId().getValue())));
- flow.setMatch(map.getMatch());
- flow.setOutGroup(map.getOutGroup());
- flow.setOutPort(map.getOutPort());
- flow.setPriority(map.getPriority());
- flow.setStrict(map.isStrict());
- flow.setTableId(tableId);
+ }
Flow flowRule = flow.build();
flowStatistics.setByteCount(flowStats.getByteCount());
flowStatistics.setPacketCount(flowStats.getPacketCount());
flowStatistics.setDuration(flowStats.getDuration());
- flowStatistics.setContainerName(map.getContainerName());
- flowStatistics.setBufferId(map.getBufferId());
- flowStatistics.setCookie(map.getCookie());
- flowStatistics.setCookieMask(map.getCookieMask());
- flowStatistics.setFlags(map.getFlags());
- flowStatistics.setFlowName(map.getFlowName());
- flowStatistics.setHardTimeout(map.getHardTimeout());
- flowStatistics.setIdleTimeout(map.getIdleTimeout());
- flowStatistics.setInstallHw(map.isInstallHw());
- flowStatistics.setInstructions(map.getInstructions());
- flowStatistics.setMatch(map.getMatch());
- flowStatistics.setOutGroup(map.getOutGroup());
- flowStatistics.setOutPort(map.getOutPort());
- flowStatistics.setPriority(map.getPriority());
- flowStatistics.setStrict(map.isStrict());
- flowStatistics.setTableId(tableId);
flowStatisticsData.setFlowStatistics(flowStatistics.build());
.augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(tableId))
.child(Flow.class,existingFlow.getKey()).toInstance();
- flowBuilder.setKey(existingFlow.getKey());
- flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
+ flow.setKey(existingFlow.getKey());
+ flow.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
logger.debug("Found matching flow in the datastore, augmenting statistics");
// Update entry with timestamp of latest response
- flow.setKey(existingFlow.getKey());
FlowStatsEntry flowStatsEntry = new FlowStatsEntry(tableId,flow.build());
- trans.putOperationalData(flowRef, flowBuilder.build());
+ trans.putOperationalData(flowRef, flow.build());
return flowStatsEntry;
}
}
.augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(tableId))
.child(Flow.class,existingFlow.getKey()).toInstance();
- flowBuilder.setKey(existingFlow.getKey());
- flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
+ flow.setKey(existingFlow.getKey());
+ flow.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
logger.debug("Found matching unaccounted flow in the operational datastore, augmenting statistics");
// Update entry with timestamp of latest response
- flow.setKey(existingFlow.getKey());
FlowStatsEntry flowStatsEntry = new FlowStatsEntry(tableId,flow.build());
- trans.putOperationalData(flowRef, flowBuilder.build());
+ trans.putOperationalData(flowRef, flow.build());
return flowStatsEntry;
}
}
InstanceIdentifier<Flow> flowRef = getNodeIdentifierBuilder().augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(tableId))
.child(Flow.class,newFlowKey).toInstance();
- flowBuilder.setKey(newFlowKey);
- flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
+ flow.setKey(newFlowKey);
+ flow.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
logger.debug("Flow {} is not present in config data store, augmenting statistics as an unaccounted flow",
- flowBuilder.build());
+ flow.build());
// Update entry with timestamp of latest response
flow.setKey(newFlowKey);
FlowStatsEntry flowStatsEntry = new FlowStatsEntry(tableId,flow.build());
- trans.putOperationalData(flowRef, flowBuilder.build());
+ trans.putOperationalData(flowRef, flow.build());
return flowStatsEntry;
}
QName qName = QName.create(value);
String identityValue = qName.getLocalName();
String identityNamespace = qName.getNamespace().toString();
- return XmlUtil.createTextElementWithNamespacedContent(doc, key, PREFIX, identityNamespace, identityValue);
+ return XmlUtil.createTextElementWithNamespacedContent(doc, key, PREFIX, identityNamespace, identityValue, namespace);
}
}
+
/*
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
*
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
-import java.util.List;
import jline.console.completer.Completer;
import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import java.util.List;
+
class LeafListEntryReader extends BasicDataHolderReader<LeafListSchemaNode> implements
GenericListEntryReader<LeafListSchemaNode> {
import java.util.Collections;
import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.ChoiceNodeBaseSerializer;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
protected NodeSerializerDispatcher<String> getNodeDispatcher() {
return dispatcher;
}
-}
\ No newline at end of file
+}
package org.opendaylight.controller.netconf.cli.writer.impl;
import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializer;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializerFactory;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
+import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
return mapNodeSerializer;
}
+ @Override
+ public FromNormalizedNodeSerializer<String, AnyXmlNode, AnyXmlSchemaNode> getAnyXmlNodeSerializer() {
+ throw new UnsupportedOperationException();
+ }
+
}
\ No newline at end of file
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@Override
public final Iterable<String> dispatchChildElement(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
if (dataContainerChild instanceof ContainerNode) {
return onContainerNode(childSchema, dataContainerChild);
} else if (dataContainerChild instanceof LeafNode<?>) {
}
private Iterable<String> onAugmentationSchema(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, AugmentationSchema.class, dataContainerChild);
return factory.getAugmentationNodeSerializer().serialize((AugmentationSchema) childSchema,
(AugmentationNode) dataContainerChild);
}
private Iterable<String> onChoiceNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, org.opendaylight.yangtools.yang.model.api.ChoiceNode.class,
dataContainerChild);
return factory.getChoiceNodeSerializer().serialize(
}
private Iterable<String> onListNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, ListSchemaNode.class, dataContainerChild);
return factory.getMapNodeSerializer().serialize((ListSchemaNode) childSchema, (MapNode) dataContainerChild);
}
private Iterable<String> onLeafListNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, LeafListSchemaNode.class, dataContainerChild);
return factory.getLeafSetNodeSerializer().serialize((LeafListSchemaNode) childSchema,
(LeafSetNode<?>) dataContainerChild);
}
private Iterable<String> onLeafNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, LeafSchemaNode.class, dataContainerChild);
final Iterable<String> elements = factory.getLeafNodeSerializer().serialize((LeafSchemaNode) childSchema,
(LeafNode<?>) dataContainerChild);
}
private static void checkOnlyOneSerializedElement(final Iterable<?> elements,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
final int size = Iterables.size(elements);
Preconditions.checkArgument(size == 1,
"Unexpected count of elements for entry serialized from: %s, should be 1, was: %s", dataContainerChild,
}
private Iterable<String> onContainerNode(final Object childSchema,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
checkSchemaCompatibility(childSchema, ContainerSchemaNode.class, dataContainerChild);
final Iterable<String> elements = factory.getContainerNodeSerializer().serialize(
}
private static void checkSchemaCompatibility(final Object childSchema, final Class<?> containerSchemaNodeClass,
- final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+ final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
Preconditions.checkArgument(containerSchemaNodeClass.isAssignableFrom(childSchema.getClass()),
"Incompatible schema: %s with node: %s, expected: %s", childSchema, dataContainerChild,
containerSchemaNodeClass);
}
-}
\ No newline at end of file
+}
import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
import org.opendaylight.controller.netconf.cli.writer.WriteException;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
return null;
}
-}
\ No newline at end of file
+}
});
}
+ /**
+ *
+ * @param tagName tag name without prefix
+ * @return
+ */
public List<XmlElement> getChildElements(final String tagName) {
return getChildElementsInternal(new ElementFilteringStrategy() {
@Override
public boolean accept(Element e) {
- return e.getTagName().equals(tagName);
+ // localName returns pure localName without prefix
+ return e.getLocalName().equals(tagName);
}
});
}
public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix,
String namespace, String contentWithoutPrefix) {
+ return createTextElementWithNamespacedContent(document, qName, prefix, namespace, contentWithoutPrefix, Optional.<String>absent());
+ }
+
+ public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix,
+ String namespace, String contentWithoutPrefix, Optional<String> namespaceURI) {
+
String content = createPrefixedValue(XmlNetconfConstants.PREFIX, contentWithoutPrefix);
- Element element = createTextElement(document, qName, content, Optional.<String>absent());
+ Element element = createTextElement(document, qName, content, namespaceURI);
String prefixedNamespaceAttr = createPrefixedValue(XMLNS_ATTRIBUTE_KEY, prefix);
element.setAttributeNS(XMLNS_URI, prefixedNamespaceAttr, namespace);
return element;
*/
List<NeutronPort> myPorts;
- boolean gatewayIPAssigned;
+ Boolean gatewayIPAssigned;
public NeutronSubnet() {
myPorts = new ArrayList<NeutronPort>();
try {
SubnetUtils util = new SubnetUtils(cidr);
SubnetInfo info = util.getInfo();
- if (gatewayIP == null) {
+ if (gatewayIP == null || ("").equals(gatewayIP)) {
gatewayIP = info.getLowAddress();
}
if (allocationPools.size() < 1) {
gatewayIPAssigned = false;
}
+ public Boolean getGatewayIPAllocated() {
+ return gatewayIPAssigned;
+ }
+
@Override
public String toString() {
return "NeutronSubnet [subnetUUID=" + subnetUUID + ", networkUUID=" + networkUUID + ", name=" + name
javax.ws.rs.core,
javax.xml.bind,
javax.xml.bind.annotation,
- org.objectweb.asm,
org.opendaylight.controller.sal.utils,
org.opendaylight.controller.sal.core,
org.opendaylight.controller.sal.authorization,
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
- service.canAttachInterface(target, input);
+ int status = service.canAttachInterface(target, input);
+ if (status < 200 || status > 299)
+ return Response.status(status).build();
}
}
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
- service.canDetachInterface(target, input);
+ int status = service.canDetachInterface(target, input);
+ if (status < 200 || status > 299)
+ return Response.status(status).build();
}
}
<module>opendaylight/commons/filter-valve</module>
<!-- Karaf Distribution -->
- <module>features/base</module>
- <module>features/controller</module>
- <module>features/adsal</module>
- <module>features/extras</module>
<module>opendaylight/dummy-console</module>
<module>opendaylight/karaf-branding</module>
<module>opendaylight/distribution/opendaylight-karaf</module>