<dependencies>
<!-- project specific dependencies -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-artifacts</artifactId>
+ <version>${config.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>netconf-artifacts</artifactId>
<type>pom</type>
<scope>import</scope>
</dependency>
+
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
</dependency>
<!-- config-->
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
- <version>${config.version}</version>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-api</artifactId>
- <version>${config.version}</version>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-api</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-directory-xml-adapter</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-file-xml-adapter</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-feature-adapter</artifactId>
- <version>${config.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-util</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-util</artifactId>
- <version>${config.version}</version>
- <type>test-jar</type>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>configuration</artifactId>
<artifactId>liblldp</artifactId>
<version>${sal.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>logback-config</artifactId>
- <version>${config.version}</version>
- </dependency>
<!-- Debug and logging -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<version>${dummy-console.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netty-config-api</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netty-event-executor-config</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netty-threadgroup-config</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>netty-timer-config</artifactId>
- <version>${config.version}</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>networkconfig.bridgedomain.northbound</artifactId>
<artifactId>sal-rest-connector-config</artifactId>
<version>${mdsal.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-netty-config</artifactId>
- <version>${config.version}</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>md-sal-config</artifactId>
<version>${karaf.security.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>shutdown-api</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>shutdown-impl</artifactId>
- <version>${config.version}</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>statistics.northbound</artifactId>
<version>${switchmanager.northbound.version}</version>
</dependency>
- <!-- threadpool -->
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>threadpool-config-api</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>threadpool-config-impl</artifactId>
- <version>${config.version}</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>topology.northbound</artifactId>
<artifactId>web</artifactId>
<version>${web.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-jmx-generator</artifactId>
- <version>${config.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-jmx-generator</artifactId>
- <version>${config.version}</version>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-test</artifactId>
- <version>${config.version}</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller.md</groupId>
<artifactId>forwardingrules-manager</artifactId>
<type>xml</type>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>features-config-netty</artifactId>
- <version>${config.version}</version>
- <classifier>features</classifier>
- <type>xml</type>
- <scope>runtime</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-flow</artifactId>
<version>${mdsal.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>features-config</artifactId>
- <version>${config.version}</version>
- <classifier>features</classifier>
- <type>xml</type>
- <scope>runtime</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-protocol-framework</artifactId>
<type>xml</type>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>features-config-persister</artifactId>
- <version>${config.version}</version>
- <classifier>features</classifier>
- <type>xml</type>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-netty-features</artifactId>
- <version>${config.version}</version>
- <classifier>features</classifier>
- <type>xml</type>
- <scope>runtime</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-base</artifactId>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ 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>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-artifacts</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-manager</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-module-archetype</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-netty-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-persister-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-persister-api</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-persister-directory-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-persister-directory-autodetect-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-persister-directory-xml-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-persister-feature-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-persister-file-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-persister-file-xml-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-plugin-parent</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-util</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>logback-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>logback-config-loader</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>netty-config-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>netty-event-executor-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>netty-threadgroup-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>netty-timer-config</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shutdown-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shutdown-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>threadpool-config-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>threadpool-config-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>yang-jmx-generator</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>yang-jmx-generator</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>yang-jmx-generator-plugin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>yang-store-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>yang-store-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>yang-test</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>features-config</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>features-config-netty</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>features-config-persister</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>config-netty-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
+
tested.put(moduleIdentifier,
mockedModule(),
- moduleFactory,
- maybeOldInternalInfo,
- transactionModuleJMXRegistration,
- isDefaultBean, mock(BundleContext.class));
+ moduleFactory,
+ maybeOldInternalInfo,
+ transactionModuleJMXRegistration,
+ isDefaultBean, mock(BundleContext.class));
}
private static Module mockedModule() {
<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
<!--
Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
-->
<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>config-subsystem</artifactId>
- <version>0.3.0-SNAPSHOT</version>
- </parent>
- <artifactId>config-netty-config</artifactId>
- <description>Configuration files for sal-rest-connector</description>
- <packaging>jar</packaging>
- <build>
- <plugins>
- <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/initial/00-netty.xml</file>
- <type>xml</type>
- <classifier>config</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-subsystem</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>config-netty-config</artifactId>
+ <description>Configuration files for sal-rest-connector</description>
+ <packaging>jar</packaging>
+ <build>
+ <plugins>
+ <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/initial/00-netty.xml</file>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
*/
package org.opendaylight.controller.config.persist.storage.directory.xml;
+import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.base.Optional;
import com.google.common.io.Files;
-import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
-import org.opendaylight.controller.config.persist.api.Persister;
-import org.opendaylight.controller.config.persist.storage.file.xml.model.ConfigSnapshot;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
-
-import static com.google.common.base.Preconditions.checkArgument;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
+import org.opendaylight.controller.config.persist.api.Persister;
+import org.opendaylight.controller.config.persist.storage.file.xml.model.ConfigSnapshot;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class XmlDirectoryPersister implements Persister {
- private static final Logger logger = LoggerFactory.getLogger(XmlDirectoryPersister.class);
+ private static final Logger LOG = LoggerFactory.getLogger(XmlDirectoryPersister.class);
private final File storage;
private final Optional<FilenameFilter> extensionsFilter;
/**
* Creates XmlDirectoryPersister that picks up all files in specified folder
*/
- public XmlDirectoryPersister(File storage) {
+ public XmlDirectoryPersister(final File storage) {
this(storage, Optional.<FilenameFilter>absent());
}
/**
* Creates XmlDirectoryPersister that picks up files only with specified file extension
*/
- public XmlDirectoryPersister(File storage, Set<String> fileExtensions) {
+ public XmlDirectoryPersister(final File storage, final Set<String> fileExtensions) {
this(storage, Optional.of(getFilter(fileExtensions)));
}
- private XmlDirectoryPersister(File storage, Optional<FilenameFilter> extensionsFilter) {
+ private XmlDirectoryPersister(final File storage, final Optional<FilenameFilter> extensionsFilter) {
checkArgument(storage.exists() && storage.isDirectory(), "Storage directory does not exist: " + storage);
this.storage = storage;
this.extensionsFilter = extensionsFilter;
}
@Override
- public void persistConfig(ConfigSnapshotHolder holder) throws IOException {
+ public void persistConfig(final ConfigSnapshotHolder holder) throws IOException {
throw new UnsupportedOperationException("This adapter is read only. Please set readonly=true on " + getClass());
}
List<File> sortedFiles = new ArrayList<>(Arrays.asList(filesArray));
Collections.sort(sortedFiles);
// combine all found files
- logger.debug("Reading files in following order: {}", sortedFiles);
+ LOG.debug("Reading files in following order: {}", sortedFiles);
List<ConfigSnapshotHolder> result = new ArrayList<>();
for (File file : sortedFiles) {
- logger.trace("Adding file '{}' to combined result", file);
+ LOG.trace("Adding file '{}' to combined result", file);
Optional<ConfigSnapshotHolder> h = fromXmlSnapshot(file);
// Ignore non valid snapshot
if(h.isPresent() == false) {
return result;
}
- private Optional<ConfigSnapshotHolder> fromXmlSnapshot(File file) {
+ private Optional<ConfigSnapshotHolder> fromXmlSnapshot(final File file) {
try {
return Optional.of(loadLastConfig(file));
} catch (JAXBException e) {
// In case of parse error, issue a warning, ignore and continue
- logger.warn(
+ LOG.warn(
"Unable to parse configuration snapshot from {}. Initial config from {} will be IGNORED in this run. " +
"Note that subsequent config files may fail due to this problem. " +
"Xml markup in this file needs to be fixed, for detailed information see enclosed exception.",
return Optional.absent();
}
- public static ConfigSnapshotHolder loadLastConfig(File file) throws JAXBException {
+ public static ConfigSnapshotHolder loadLastConfig(final File file) throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance(ConfigSnapshot.class);
Unmarshaller um = jaxbContext.createUnmarshaller();
return new FilenameFilter() {
@Override
- public boolean accept(File dir, String name) {
+ public boolean accept(final File dir, final String name) {
String ext = Files.getFileExtension(name);
return fileExtensions.contains(ext);
}
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
+import java.io.File;
+import java.util.Set;
import org.opendaylight.controller.config.persist.api.Persister;
import org.opendaylight.controller.config.persist.api.PropertiesProvider;
import org.opendaylight.controller.config.persist.api.StorageAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.util.Set;
-
/**
* StorageAdapter that retrieves initial configuration from a directory. If multiple files are present, snapshot and
* required capabilities will be merged together. Writing to this persister is not supported.
*/
public class XmlDirectoryStorageAdapter implements StorageAdapter {
- private static final Logger logger = LoggerFactory.getLogger(XmlDirectoryStorageAdapter.class);
+ private static final Logger LOG = LoggerFactory.getLogger(XmlDirectoryStorageAdapter.class);
public static final String DIRECTORY_STORAGE_PROP = "directoryStorage";
public static final String INCLUDE_EXT_PROP = "includeExtensions";
@Override
- public Persister instantiate(PropertiesProvider propertiesProvider) {
+ public Persister instantiate(final PropertiesProvider propertiesProvider) {
String fileStorageProperty = propertiesProvider.getProperty(DIRECTORY_STORAGE_PROP);
Preconditions.checkNotNull(fileStorageProperty, "Unable to find " + propertiesProvider.getFullKeyForReporting(DIRECTORY_STORAGE_PROP));
File storage = new File(fileStorageProperty);
String fileExtensions = propertiesProvider.getProperty(INCLUDE_EXT_PROP);
- logger.debug("Using storage: {}", storage);
+ LOG.debug("Using storage: {}", storage);
if(fileExtensions != null) {
- logger.debug("Using extensions: {}", fileExtensions);
+ LOG.debug("Using extensions: {}", fileExtensions);
return new XmlDirectoryPersister(storage, splitExtensions(fileExtensions));
} else {
return new XmlDirectoryPersister(storage);
}
}
- private Set<String> splitExtensions(String fileExtensions) {
+ private Set<String> splitExtensions(final String fileExtensions) {
return Sets.newHashSet(Splitter.on(EXTENSIONS_SEPARATOR).trimResults().omitEmptyStrings()
.split(fileExtensions));
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
+import com.google.common.base.Optional;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.SortedSet;
-
import org.junit.Test;
import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
import org.opendaylight.controller.config.persist.api.Persister;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
-import com.google.common.base.Optional;
-
public class DirectoryStorageAdapterTest {
+ private static final Logger LOG = LoggerFactory.getLogger(DirectoryStorageAdapterTest.class);
Persister tested;
- Logger logger = LoggerFactory.getLogger(DirectoryStorageAdapterTest.class.toString());
- private Persister instantiatePersisterFromAdapter(File file, Optional<String> extensions){
+ private Persister instantiatePersisterFromAdapter(final File file, final Optional<String> extensions){
PropertiesProviderTest pp = new PropertiesProviderTest();
pp.addProperty(XmlDirectoryStorageAdapter.DIRECTORY_STORAGE_PROP,file.getPath());
if(extensions.isPresent()) {
return dsa.instantiate(pp);
}
- private Persister instantiatePersisterFromAdapter(File file){
+ private Persister instantiatePersisterFromAdapter(final File file){
return instantiatePersisterFromAdapter(file, Optional.<String>absent());
}
}
}
- private File getFolder(String folderName) {
+ private File getFolder(final String folderName) {
File result = new File(("src/test/resources/" +
folderName).replace("/", File.separator));
assertTrue(result + " is not a directory", result.isDirectory());
File folder = getFolder("oneFile");
tested = instantiatePersisterFromAdapter(folder, Optional.of("xml"));
- logger.info("Testing : " + tested.toString());
+ LOG.info("Testing : {}", tested);
List<ConfigSnapshotHolder> results = tested.loadLastConfigs();
assertEquals(1, results.size());
ConfigSnapshotHolder result = results.get(0);
public void testOneFileWrongExtension() throws Exception {
File folder = getFolder("oneFile");
tested = instantiatePersisterFromAdapter(folder, Optional.of("aa, bb"));
- logger.info("Testing : " + tested.toString());
+ LOG.info("Testing : {}", tested);
}
- private void assertResult(ConfigSnapshotHolder result, String s, String... caps) throws SAXException, IOException {
+ private void assertResult(final ConfigSnapshotHolder result, final String s, final String... caps) throws SAXException, IOException {
assertXMLEqual(s, result.getConfigSnapshot());
int i = 0;
for (String capFromSnapshot : result.getCapabilities()) {
public void testTwoFilesAllExtensions() throws Exception {
File folder = getFolder("twoFiles");
tested = instantiatePersisterFromAdapter(folder);
- logger.info("Testing : " + tested.toString());
+ LOG.info("Testing : {}", tested);
List<ConfigSnapshotHolder> results = tested.loadLastConfigs();
assertEquals(2, results.size());
public void testTwoFilesTwoExtensions() throws Exception {
File folder = getFolder("twoFiles");
tested = instantiatePersisterFromAdapter(folder, Optional.of("xml, xml2"));
- logger.info("Testing : " + tested.toString());
+ LOG.info("Testing : {}", tested);
assertEquals(2, tested.loadLastConfigs().size());
}
public void testTwoFilesOnlyOneExtension() throws Exception {
File folder = getFolder("twoFiles");
tested = instantiatePersisterFromAdapter(folder, Optional.of("xml"));
- logger.info("Testing : " + tested.toString());
+ LOG.info("Testing : ", tested);
List<ConfigSnapshotHolder> results = tested.loadLastConfigs();
assertEquals(1, results.size());
public void testTwoFilesOneInvalid() throws Exception {
File folder = getFolder("twoFiles_corrupt");
tested = instantiatePersisterFromAdapter(folder, Optional.of("xml"));
- logger.info("Testing : " + tested.toString());
+ LOG.info("Testing : {}", tested);
List<ConfigSnapshotHolder> results = tested.loadLastConfigs();
assertEquals(1, results.size());
import org.slf4j.LoggerFactory;
public class ConfigPusherCustomizer implements ServiceTrackerCustomizer<ConfigPusher, ConfigPusher>, AutoCloseable {
- private static final Logger LOGGER = LoggerFactory.getLogger(ConfigPusherCustomizer.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigPusherCustomizer.class);
private ConfigFeaturesListener configFeaturesListener = null;
private FeatureServiceCustomizer featureServiceCustomizer = null;
private ServiceTracker<FeaturesService,FeaturesService> fsst = null;
@Override
public ConfigPusher addingService(ServiceReference<ConfigPusher> configPusherServiceReference) {
- LOGGER.trace("Got ConfigPusherCustomizer.addingService {}", configPusherServiceReference);
+ LOG.trace("Got ConfigPusherCustomizer.addingService {}", configPusherServiceReference);
BundleContext bc = configPusherServiceReference.getBundle().getBundleContext();
ConfigPusher cpService = bc.getService(configPusherServiceReference);
featureServiceCustomizer = new FeatureServiceCustomizer(cpService);
while(true) {
try {
if(!interuppted) {
- if(toInstall.isEmpty()) {
- event = queue.take();
- } else {
- event = queue.poll(POLL_TIME, TimeUnit.MILLISECONDS);
- }
- if(event != null && event.getFeature() !=null) {
- processFeatureEvent(event,toInstall);
- }
+ if(toInstall.isEmpty()) {
+ event = queue.take();
+ } else {
+ event = queue.poll(POLL_TIME, TimeUnit.MILLISECONDS);
+ }
+ if(event != null && event.getFeature() !=null) {
+ processFeatureEvent(event,toInstall);
+ }
} else if(toInstall.isEmpty()) {
LOGGER.error("ConfigPushingRunnable - exiting");
return;
*/
package org.opendaylight.controller.configpusherfeature.internal;
+import com.google.common.collect.LinkedHashMultimap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
-
import org.apache.karaf.features.Feature;
import org.apache.karaf.features.FeaturesService;
import org.opendaylight.controller.config.persist.api.ConfigPusher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.collect.LinkedHashMultimap;
-
/*
* Simple class to push configs to the config subsystem from Feature's configfiles
*/
public class FeatureConfigPusher {
- private static final Logger LOGGER = LoggerFactory.getLogger(FeatureConfigPusher.class);
+ private static final Logger LOG = LoggerFactory.getLogger(FeatureConfigPusher.class);
private static final int MAX_RETRIES=100;
private static final int RETRY_PAUSE_MILLIS=1;
private FeaturesService featuresService = null;
/*
* @param p - ConfigPusher to push ConfigSnapshotHolders
*/
- public FeatureConfigPusher(ConfigPusher p, FeaturesService f) {
+ public FeatureConfigPusher(final ConfigPusher p, final FeaturesService f) {
pusher = p;
featuresService = f;
}
* If a Feature is not in the returned LinkedHashMultimap then we couldn't push its configs
* (Ususally because it was not yet installed)
*/
- public LinkedHashMultimap<Feature,FeatureConfigSnapshotHolder> pushConfigs(List<Feature> features) throws Exception, InterruptedException {
+ public LinkedHashMultimap<Feature,FeatureConfigSnapshotHolder> pushConfigs(final List<Feature> features) throws Exception, InterruptedException {
LinkedHashMultimap<Feature,FeatureConfigSnapshotHolder> pushedFeatures = LinkedHashMultimap.create();
for(Feature feature: features) {
LinkedHashSet<FeatureConfigSnapshotHolder> configSnapShots = pushConfig(feature);
return pushedFeatures;
}
- private LinkedHashSet<FeatureConfigSnapshotHolder> pushConfig(Feature feature) throws Exception, InterruptedException {
+ private LinkedHashSet<FeatureConfigSnapshotHolder> pushConfig(final Feature feature) throws Exception, InterruptedException {
LinkedHashSet<FeatureConfigSnapshotHolder> configs = new LinkedHashSet<FeatureConfigSnapshotHolder>();
if(isInstalled(feature)) {
ChildAwareFeatureWrapper wrappedFeature = new ChildAwareFeatureWrapper(feature,featuresService);
return configs;
}
- private boolean isInstalled(Feature feature) {
+ private boolean isInstalled(final Feature feature) {
for(int retries=0;retries<MAX_RETRIES;retries++) {
try {
List<Feature> installedFeatures = Arrays.asList(featuresService.listInstalledFeatures());
if(installedFeatures.contains(feature)) {
return true;
} else {
- LOGGER.warn("Karaf featuresService.listInstalledFeatures() has not yet finished installing feature (retry {}) {} {}",retries,feature.getName(),feature.getVersion());
+ LOG.warn("Karaf featuresService.listInstalledFeatures() has not yet finished installing feature (retry {}) {} {}",retries,feature.getName(),feature.getVersion());
}
} catch (Exception e) {
if(retries < MAX_RETRIES) {
- LOGGER.warn("Karaf featuresService.listInstalledFeatures() has thrown an exception, retry {}, Exception {}", retries,e);
+ LOG.warn("Karaf featuresService.listInstalledFeatures() has thrown an exception, retry {}", retries, e);
} else {
- LOGGER.error("Giving up on Karaf featuresService.listInstalledFeatures() which has thrown an exception, retry {}, Exception {}", retries,e);
+ LOG.error("Giving up on Karaf featuresService.listInstalledFeatures() which has thrown an exception, retry {}", retries, e);
throw e;
}
}
throw new IllegalStateException(e1);
}
}
- LOGGER.error("Giving up (after {} retries) on Karaf featuresService.listInstalledFeatures() which has not yet finished installing feature {} {}",MAX_RETRIES,feature.getName(),feature.getVersion());
+ LOG.error("Giving up (after {} retries) on Karaf featuresService.listInstalledFeatures() which has not yet finished installing feature {} {}",MAX_RETRIES,feature.getName(),feature.getVersion());
return false;
}
- private LinkedHashSet<FeatureConfigSnapshotHolder> pushConfig(LinkedHashSet<FeatureConfigSnapshotHolder> configs) throws InterruptedException {
+ private LinkedHashSet<FeatureConfigSnapshotHolder> pushConfig(final LinkedHashSet<FeatureConfigSnapshotHolder> configs) throws InterruptedException {
LinkedHashSet<FeatureConfigSnapshotHolder> configsToPush = new LinkedHashSet<FeatureConfigSnapshotHolder>(configs);
configsToPush.removeAll(pushedConfigs);
if(!configsToPush.isEmpty()) {
@Override
public String toString() {
- StringBuilder b = new StringBuilder();
- Path p = Paths.get(fileInfo.getFinalname());
- b.append(p.getFileName())
- .append("(")
- .append(getCauseFeature())
- .append(",")
- .append(getFeature())
- .append(")");
- return b.toString();
-
+ StringBuilder b = new StringBuilder();
+ Path p = Paths.get(fileInfo.getFinalname());
+ b.append(p.getFileName())
+ .append("(")
+ .append(getCauseFeature())
+ .append(",")
+ .append(getFeature())
+ .append(")");
+ return b.toString();
}
@Override
public void testLookupConfigBeans2() throws Exception {
Method method = LookupRegistry.class.getMethod("lookupConfigBeans",
String.class, String.class);
- Object[] args = new Object[] { TestingConfigRegistry.moduleName1,
- TestingConfigRegistry.instName1 };
+ Object[] args = new Object[] { TestingConfigRegistry.moduleName1, TestingConfigRegistry.instName1 };
test(method, args);
}
public void testLookupConfigBean() throws Exception {
Method method = LookupRegistry.class.getMethod("lookupConfigBean",
String.class, String.class);
- Object[] args = new Object[] { TestingConfigRegistry.moduleName1,
- TestingConfigRegistry.instName1 };
+ Object[] args = new Object[] { TestingConfigRegistry.moduleName1, TestingConfigRegistry.instName1 };
test(method, args);
}
// check logs
String[] expectedLogs = new String[] {
- "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.LogbackConfigurationLoaderTest: LOGBACK ready -> about to use it",
- "LoggingEvent -> [TRACE] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: tracing",
- "LoggingEvent -> [DEBUG] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: debugging",
- "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: infoing",
- "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: warning",
- "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: erroring",
- "LoggingEvent -> [DEBUG] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: debugging",
- "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: infoing",
- "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: warning",
- "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: erroring",
- "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: infoing",
- "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: warning",
- "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: erroring",
- "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Warner: warning",
- "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Warner: erroring",
- "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Errorer: erroring"
-
+ "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.LogbackConfigurationLoaderTest: LOGBACK ready -> about to use it",
+ "LoggingEvent -> [TRACE] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: tracing",
+ "LoggingEvent -> [DEBUG] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: debugging",
+ "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: infoing",
+ "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: warning",
+ "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: erroring",
+ "LoggingEvent -> [DEBUG] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: debugging",
+ "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: infoing",
+ "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: warning",
+ "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: erroring",
+ "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: infoing",
+ "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: warning",
+ "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: erroring",
+ "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Warner: warning",
+ "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Warner: erroring",
+ "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Errorer: erroring"
};
List<String> logSnapshot = new ArrayList<>(TestAppender.getLogRecord());
-<?xml version="1.0" encoding="UTF-8"?>\r
-<configuration debug="true">\r
-\r
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">\r
- <encoder>\r
- <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>\r
- </encoder>\r
- </appender>\r
-\r
- <root level="INFO">\r
- <appender-ref ref="STDOUT" />\r
- </root>\r
-\r
- <!-- Base log level -->\r
- <logger name="org.opendaylight.controller.logback.config.loader" level="DEBUG"/>\r
-\r
-</configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="true">
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <!-- Base log level -->
+ <logger name="org.opendaylight.controller.logback.config.loader" level="DEBUG"/>
+
+</configuration>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<configuration debug="false">\r
-\r
- <appender name="TEST" class="org.opendaylight.controller.logback.config.loader.test.TestAppender"/>\r
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">\r
- <encoder>\r
- <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>\r
- </encoder>\r
- </appender>\r
-\r
- <root level="INFO">\r
- <appender-ref ref="TEST" />\r
- <appender-ref ref="STDOUT" />\r
- </root>\r
-\r
- <!-- Base log level -->\r
- <logger name="org.opendaylight.controller.logback.config.loader" level="INFO"/>\r
-\r
-</configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false">
+
+ <appender name="TEST" class="org.opendaylight.controller.logback.config.loader.test.TestAppender"/>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="INFO">
+ <appender-ref ref="TEST" />
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <!-- Base log level -->
+ <logger name="org.opendaylight.controller.logback.config.loader" level="INFO"/>
+
+</configuration>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<configuration debug="false">\r
-\r
- <!-- Base log level -->\r
- <logger name="org.opendaylight.controller.logback.config.loader" level="DEBUG"/>\r
- <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Tracer" level="TRACE"/>\r
-<!-- <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Debugger" level="DEBUG"/> -->\r
- <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Informer" level="DEBUG"/>\r
- <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Warner" level="ERROR"/>\r
- <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Errorer" level="ERROR"/>\r
-\r
-</configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false">
+
+ <!-- Base log level -->
+ <logger name="org.opendaylight.controller.logback.config.loader" level="DEBUG"/>
+ <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Tracer" level="TRACE"/>
+<!-- <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Debugger" level="DEBUG"/> -->
+ <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Informer" level="DEBUG"/>
+ <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Warner" level="ERROR"/>
+ <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Errorer" level="ERROR"/>
+
+</configuration>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<configuration debug="false">\r
- <root level="INFO">\r
- <appender-ref ref="TEST" />\r
- </root>\r
-\r
- <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Informer" level="INFO"/>\r
- <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Warner" level="WARN"/>\r
-\r
- <logger name="org.opendaylight.controller.logback.config.loader.test.LogbackConfigurationLoaderTest" level="TRACE"/>\r
-</configuration>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false">
+ <root level="INFO">
+ <appender-ref ref="TEST" />
+ </root>
+
+ <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Informer" level="INFO"/>
+ <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Warner" level="WARN"/>
+
+ <logger name="org.opendaylight.controller.logback.config.loader.test.LogbackConfigurationLoaderTest" level="TRACE"/>
+</configuration>
/**
*
*/
-public final class NetconfClientDispatcherModule extends org.opendaylight.controller.config.yang.config.netconf.client.dispatcher.AbstractNetconfClientDispatcherModule
- {
+public final class NetconfClientDispatcherModule extends org.opendaylight.controller.config.yang.config.netconf.client.dispatcher.AbstractNetconfClientDispatcherModule {
public NetconfClientDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
<module>netconf-config-dispatcher</module>
<module>config-module-archetype</module>
<module>config-netty-config</module>
+
+ <module>config-artifacts</module>
</modules>
<dependencies>
String varName = BindingGeneratorUtil
.parseToValidParamName(attrEntry.getKey());
- {
- ModuleField field;
+ ModuleField field;
if (isIdentity) {
String identityBaseClass = getInnerTypeFromIdentity(((TypedAttribute) attributeIfc).getType());
IdentityRefModuleField identityField = new IdentityRefModuleField(type, varName,
nullableDefaultWrapped, isDependency, dependency, isListOfDependencies, needsDepResolver);
}
moduleFields.add(field);
- }
+
+
String getterName = "get"
+ attributeIfc.getUpperCaseCammelCase();
MethodDefinition getter = new MethodDefinition(type,
.append("}\n");
} else {
result.append(format(
- "private %s %sDependency;\n"+
- "protected final %s get%sDependency(){\n"+
- "return %sDependency;\n"+
- "}",
- osgi, moduleField.getName(), osgi, moduleField.getAttributeName(), moduleField.getName()));
+ "private %s %sDependency;\n"+
+ "protected final %s get%sDependency(){\n"+
+ "return %sDependency;\n"+
+ "}",
+ osgi, moduleField.getName(), osgi, moduleField.getAttributeName(), moduleField.getName()));
}
}
}
import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
public class Dependency {
- private final ServiceInterfaceEntry sie;
- private final boolean mandatory;
+ private final ServiceInterfaceEntry sie;
+ private final boolean mandatory;
- public Dependency(ServiceInterfaceEntry sie, boolean mandatory) {
- this.sie = sie;
- this.mandatory = mandatory;
- }
+ public Dependency(ServiceInterfaceEntry sie, boolean mandatory) {
+ this.sie = sie;
+ this.mandatory = mandatory;
+ }
- public ServiceInterfaceEntry getSie() {
- return sie;
- }
+ public ServiceInterfaceEntry getSie() {
+ return sie;
+ }
- public boolean isMandatory() {
- return mandatory;
- }
+ public boolean isMandatory() {
+ return mandatory;
+ }
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
- Dependency that = (Dependency) o;
+ Dependency that = (Dependency) o;
- if (mandatory != that.mandatory)
- return false;
- if (!sie.equals(that.sie))
- return false;
+ if (mandatory != that.mandatory)
+ return false;
+ if (!sie.equals(that.sie))
+ return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = sie.hashCode();
- result = 31 * result + (mandatory ? 1 : 0);
- return result;
- }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = sie.hashCode();
+ result = 31 * result + (mandatory ? 1 : 0);
+ return result;
}
+}
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>yang-jmx-generator-plugin</artifactId>
- <version>${config.version}</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.netconf.impl.mapping.operations;\r
-\r
-import org.opendaylight.controller.netconf.impl.NetconfServerSession;\r
-\r
-public interface DefaultNetconfOperation {\r
- void setNetconfSession(NetconfServerSession s);\r
-}\r
+/*
+ * 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.netconf.impl.mapping.operations;
+
+import org.opendaylight.controller.netconf.impl.NetconfServerSession;
+
+public interface DefaultNetconfOperation {
+ void setNetconfSession(NetconfServerSession s);
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.netconf.impl.mapping.operations;\r
-\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException;\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity;\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag;\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType;\r
-import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;\r
-import org.opendaylight.controller.netconf.api.NetconfMessage;\r
-import org.opendaylight.controller.netconf.impl.NetconfServerSession;\r
-import org.opendaylight.controller.netconf.mapping.api.NetconfOperationChainedExecution;\r
-import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;\r
-import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.w3c.dom.Document;\r
-import org.w3c.dom.Element;\r
-public class DefaultStartExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {\r
- public static final String START_EXI = "start-exi";\r
-\r
- private static final Logger logger = LoggerFactory.getLogger(DefaultStartExi.class);\r
- private NetconfServerSession netconfSession;\r
-\r
- public DefaultStartExi(String netconfSessionIdForReporting) {\r
- super(netconfSessionIdForReporting);\r
- }\r
-\r
- @Override\r
- public Document handle(Document message,\r
- NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException {\r
- logger.debug("Received start-exi message {} ", XmlUtil.toString(message));\r
-\r
- try {\r
- netconfSession.startExiCommunication(new NetconfMessage(message));\r
- } catch (IllegalArgumentException e) {\r
- throw new NetconfDocumentedException("Failed to parse EXI parameters", ErrorType.protocol,\r
- ErrorTag.operation_failed, ErrorSeverity.error);\r
- }\r
-\r
- return super.handle(message, subsequentOperation);\r
- }\r
-\r
- @Override\r
- protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {\r
- Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK);\r
- logger.trace("{} operation successful", START_EXI);\r
- return getSchemaResult;\r
- }\r
-\r
- @Override\r
- protected String getOperationName() {\r
- return START_EXI;\r
- }\r
-\r
- @Override\r
- protected String getOperationNamespace() {\r
- return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0;\r
- }\r
-\r
- @Override\r
- public void setNetconfSession(NetconfServerSession s) {\r
- netconfSession = s;\r
- }\r
-}\r
+/*
+ * 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.netconf.impl.mapping.operations;
+
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType;
+import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.impl.NetconfServerSession;
+import org.opendaylight.controller.netconf.mapping.api.NetconfOperationChainedExecution;
+import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;
+import org.opendaylight.controller.netconf.util.xml.XmlElement;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+public class DefaultStartExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {
+ public static final String START_EXI = "start-exi";
+
+ private static final Logger logger = LoggerFactory.getLogger(DefaultStartExi.class);
+ private NetconfServerSession netconfSession;
+
+ public DefaultStartExi(String netconfSessionIdForReporting) {
+ super(netconfSessionIdForReporting);
+ }
+
+ @Override
+ public Document handle(Document message,
+ NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException {
+ logger.debug("Received start-exi message {} ", XmlUtil.toString(message));
+
+ try {
+ netconfSession.startExiCommunication(new NetconfMessage(message));
+ } catch (IllegalArgumentException e) {
+ throw new NetconfDocumentedException("Failed to parse EXI parameters", ErrorType.protocol,
+ ErrorTag.operation_failed, ErrorSeverity.error);
+ }
+
+ return super.handle(message, subsequentOperation);
+ }
+
+ @Override
+ protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {
+ Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK);
+ logger.trace("{} operation successful", START_EXI);
+ return getSchemaResult;
+ }
+
+ @Override
+ protected String getOperationName() {
+ return START_EXI;
+ }
+
+ @Override
+ protected String getOperationNamespace() {
+ return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0;
+ }
+
+ @Override
+ public void setNetconfSession(NetconfServerSession s) {
+ netconfSession = s;
+ }
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.netconf.impl.mapping.operations;\r
-\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException;\r
-import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;\r
-import org.opendaylight.controller.netconf.impl.NetconfServerSession;\r
-import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;\r
-import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.w3c.dom.Document;\r
-import org.w3c.dom.Element;\r
-\r
-public class DefaultStopExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {\r
-\r
- public static final String STOP_EXI = "stop-exi";\r
- private NetconfServerSession netconfSession;\r
-\r
- private static final Logger logger = LoggerFactory\r
- .getLogger(DefaultStartExi.class);\r
-\r
- public DefaultStopExi(String netconfSessionIdForReporting) {\r
- super(netconfSessionIdForReporting);\r
- }\r
-\r
- @Override\r
- protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {\r
- logger.debug("Received stop-exi message {} ", XmlUtil.toString(operationElement));\r
-\r
- netconfSession.stopExiCommunication();\r
-\r
- Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK);\r
- logger.trace("{} operation successful", STOP_EXI);\r
- return getSchemaResult;\r
- }\r
-\r
- @Override\r
- protected String getOperationName() {\r
- return STOP_EXI;\r
- }\r
-\r
- @Override\r
- protected String getOperationNamespace() {\r
- return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0;\r
- }\r
-\r
- @Override\r
- public void setNetconfSession(NetconfServerSession s) {\r
- this.netconfSession = s;\r
- }\r
-}\r
+/*
+ * 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.netconf.impl.mapping.operations;
+
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
+import org.opendaylight.controller.netconf.impl.NetconfServerSession;
+import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;
+import org.opendaylight.controller.netconf.util.xml.XmlElement;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class DefaultStopExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {
+
+ public static final String STOP_EXI = "stop-exi";
+ private NetconfServerSession netconfSession;
+
+ private static final Logger logger = LoggerFactory
+ .getLogger(DefaultStartExi.class);
+
+ public DefaultStopExi(String netconfSessionIdForReporting) {
+ super(netconfSessionIdForReporting);
+ }
+
+ @Override
+ protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {
+ logger.debug("Received stop-exi message {} ", XmlUtil.toString(operationElement));
+
+ netconfSession.stopExiCommunication();
+
+ Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK);
+ logger.trace("{} operation successful", STOP_EXI);
+ return getSchemaResult;
+ }
+
+ @Override
+ protected String getOperationName() {
+ return STOP_EXI;
+ }
+
+ @Override
+ protected String getOperationNamespace() {
+ return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0;
+ }
+
+ @Override
+ public void setNetconfSession(NetconfServerSession s) {
+ this.netconfSession = s;
+ }
+}
final String alignmentTextContent = alignmentElement.getTextContent().trim();
switch (alignmentTextContent) {
- case EXI_PARAMETER_BIT_PACKED:
- options.setAlignmentType(AlignmentType.bitPacked);
- break;
- case EXI_PARAMETER_BYTE_ALIGNED:
- options.setAlignmentType(AlignmentType.byteAligned);
- break;
- case EXI_PARAMETER_COMPRESSED:
- options.setAlignmentType(AlignmentType.compress);
- break;
- case EXI_PARAMETER_PRE_COMPRESSION:
- options.setAlignmentType(AlignmentType.preCompress);
- break;
+ case EXI_PARAMETER_BIT_PACKED:
+ options.setAlignmentType(AlignmentType.bitPacked);
+ break;
+ case EXI_PARAMETER_BYTE_ALIGNED:
+ options.setAlignmentType(AlignmentType.byteAligned);
+ break;
+ case EXI_PARAMETER_COMPRESSED:
+ options.setAlignmentType(AlignmentType.compress);
+ break;
+ case EXI_PARAMETER_PRE_COMPRESSION:
+ options.setAlignmentType(AlignmentType.preCompress);
+ break;
}
}
-<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" a="64" message-id="a">\r
-<start-exi xmlns="urn:ietf:params:xml:ns:netconf:exi:1.0">\r
-<alignment>pre-compression</alignment>\r
-<fidelity>\r
-<dtd/>\r
-<lexical-values/>\r
-</fidelity>\r
-</start-exi>\r
-</rpc>
\ No newline at end of file
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" a="64" message-id="a">
+<start-exi xmlns="urn:ietf:params:xml:ns:netconf:exi:1.0">
+<alignment>pre-compression</alignment>
+<fidelity>
+<dtd/>
+<lexical-values/>
+</fidelity>
+</start-exi>
+</rpc>
-<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">\r
- <stop-exi xmlns="urn:ietf:params:xml:ns:netconf:exi:1.0"/>\r
-</rpc>
\ No newline at end of file
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <stop-exi xmlns="urn:ietf:params:xml:ns:netconf:exi:1.0"/>
+</rpc>