*/
@Override
public synchronized ObjectName beginConfig() {
- return beginConfigInternal().getControllerObjectName();
+ return beginConfig(false);
}
- private synchronized ConfigTransactionControllerInternal beginConfigInternal() {
+ /**
+ * @param blankTransaction true if this transaction is created automatically by
+ * org.opendaylight.controller.config.manager.impl.osgi.BlankTransactionServiceTracker
+ */
+ public synchronized ObjectName beginConfig(boolean blankTransaction) {
+ return beginConfigInternal(blankTransaction).getControllerObjectName();
+ }
+
+ private synchronized ConfigTransactionControllerInternal beginConfigInternal(boolean blankTransaction) {
versionCounter++;
String transactionName = "ConfigTransaction-" + version + "-" + versionCounter;
TransactionJMXRegistrator transactionRegistrator = baseJMXRegistrator
Map<String, Map.Entry<ModuleFactory, BundleContext>> allCurrentFactories = Collections.unmodifiableMap(resolver.getAllFactories());
ConfigTransactionControllerInternal transactionController = new ConfigTransactionControllerImpl(
transactionName, transactionRegistrator, version,
- versionCounter, allCurrentFactories, transactionsMBeanServer, configMBeanServer, bundleContext);
+ versionCounter, allCurrentFactories, transactionsMBeanServer, configMBeanServer, blankTransaction);
try {
transactionRegistrator.registerMBean(transactionController, transactionController.getControllerObjectName());
} catch (InstanceAlreadyExistsException e) {
RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator;
if (entry.hasOldModule() == false) {
runtimeBeanRegistrator = baseJMXRegistrator
- .createRuntimeBeanRegistrator(entry.getName());
+ .createRuntimeBeanRegistrator(entry.getIdentifier());
} else {
// reuse old JMX registrator
runtimeBeanRegistrator = entry.getOldInternalInfo()
.setRuntimeBeanRegistrator(runtimeBeanRegistrator);
}
// save it to info so it is accessible afterwards
- runtimeRegistrators.put(entry.getName(), runtimeBeanRegistrator);
+ runtimeRegistrators.put(entry.getIdentifier(), runtimeBeanRegistrator);
}
// can register runtime beans
// determine if current instance was recreated or reused or is new
// rules for closing resources:
- // osgi registration - will be (re)created every time, so it needs
- // to be closed here
+ // osgi registration - will be reused if possible.
// module jmx registration - will be (re)created every time, needs
// to be closed here
// runtime jmx registration - should be taken care of by module
ModuleInternalInfo oldInternalInfo = entry.getOldInternalInfo();
DynamicReadableWrapper oldReadableConfigBean = oldInternalInfo
.getReadableModule();
- currentConfig.remove(entry.getName());
+ currentConfig.remove(entry.getIdentifier());
// test if old instance == new instance
if (oldReadableConfigBean.getInstance().equals(module.getInstance())) {
BundleContext bc = configTransactionController.
getModuleFactoryBundleContext(moduleFactory.getImplementationName());
osgiRegistration = beanToOsgiServiceManager.registerToOsgi(module.getClass(),
- newReadableConfigBean.getInstance(), entry.getName(), bc);
+ newReadableConfigBean.getInstance(), entry.getIdentifier(), bc);
} else {
throw new NullPointerException(entry.getIdentifier().getFactoryName() + " ModuleFactory not found.");
}
}
RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator = runtimeRegistrators
- .get(entry.getName());
+ .get(entry.getIdentifier());
ModuleInternalInfo newInfo = new ModuleInternalInfo(
- entry.getName(), newReadableConfigBean, osgiRegistration,
+ entry.getIdentifier(), newReadableConfigBean, osgiRegistration,
runtimeBeanRegistrator, newModuleJMXRegistrator,
- orderingIdx);
+ orderingIdx, entry.isDefaultBean());
newConfigEntries.put(module, newInfo);
orderingIdx++;
/**
* Abort open transactions and unregister read only modules. Since this
* class is not responsible for registering itself under
- * {@link ConfigRegistryMXBean#OBJECT_NAME}, it will not unregister itself
+ * {@link org.opendaylight.controller.config.api.ConfigRegistry#OBJECT_NAME}, it will not unregister itself
* here.
*/
@Override
configBeanModificationDisabled);
private final MBeanServer configMBeanServer;
- private final BundleContext bundleContext;
+ private final boolean blankTransaction;
public ConfigTransactionControllerImpl(String transactionName,
TransactionJMXRegistrator transactionRegistrator,
long parentVersion, long currentVersion,
Map<String, Map.Entry<ModuleFactory, BundleContext>> currentlyRegisteredFactories,
- MBeanServer transactionsMBeanServer, MBeanServer configMBeanServer, BundleContext bundleContext) {
+ MBeanServer transactionsMBeanServer, MBeanServer configMBeanServer,
+ boolean blankTransaction) {
this.transactionIdentifier = new TransactionIdentifier(transactionName);
this.controllerON = ObjectNameUtil
this.dependencyResolverManager = new DependencyResolverManager(transactionName, transactionStatus);
this.transactionsMBeanServer = transactionsMBeanServer;
this.configMBeanServer = configMBeanServer;
- this.bundleContext = bundleContext;
+ this.blankTransaction = blankTransaction;
}
@Override
// ensure default module to be registered to jmx even if its module factory does not use dependencyResolverFactory
DependencyResolver dependencyResolver = dependencyResolverManager.getOrCreate(module.getIdentifier());
try {
- putConfigBeanToJMXAndInternalMaps(module.getIdentifier(), module, moduleFactory, null, dependencyResolver);
+ boolean defaultBean = true;
+ putConfigBeanToJMXAndInternalMaps(module.getIdentifier(), module, moduleFactory, null, dependencyResolver, defaultBean);
} catch (InstanceAlreadyExistsException e) {
throw new IllegalStateException(e);
}
"Error while copying old configuration from %s to %s",
oldConfigBeanInfo, moduleFactory), e);
}
- putConfigBeanToJMXAndInternalMaps(moduleIdentifier, module, moduleFactory, oldConfigBeanInfo, dependencyResolver);
+ putConfigBeanToJMXAndInternalMaps(moduleIdentifier, module, moduleFactory, oldConfigBeanInfo, dependencyResolver,
+ oldConfigBeanInfo.isDefaultBean());
}
@Override
DependencyResolver dependencyResolver = dependencyResolverManager.getOrCreate(moduleIdentifier);
Module module = moduleFactory.createModule(instanceName, dependencyResolver,
getModuleFactoryBundleContext(moduleFactory.getImplementationName()));
+ boolean defaultBean = false;
return putConfigBeanToJMXAndInternalMaps(moduleIdentifier, module,
- moduleFactory, null, dependencyResolver);
+ moduleFactory, null, dependencyResolver, defaultBean);
}
private synchronized ObjectName putConfigBeanToJMXAndInternalMaps(
ModuleIdentifier moduleIdentifier, Module module,
ModuleFactory moduleFactory,
- @Nullable ModuleInternalInfo maybeOldConfigBeanInfo, DependencyResolver dependencyResolver)
+ @Nullable ModuleInternalInfo maybeOldConfigBeanInfo, DependencyResolver dependencyResolver, boolean isDefaultBean)
throws InstanceAlreadyExistsException {
logger.debug("Adding module {} to transaction {}", moduleIdentifier, this);
.registerMBean(writableDynamicWrapper, writableON);
ModuleInternalTransactionalInfo moduleInternalTransactionalInfo = new ModuleInternalTransactionalInfo(
moduleIdentifier, module, moduleFactory,
- maybeOldConfigBeanInfo, transactionModuleJMXRegistration);
+ maybeOldConfigBeanInfo, transactionModuleJMXRegistration, isDefaultBean);
dependencyResolverManager.put(moduleInternalTransactionalInfo);
return writableON;
}
@Override
- public void destroyModule(ObjectName objectName)
+ public synchronized void destroyModule(ObjectName objectName)
throws InstanceNotFoundException {
String foundTransactionName = ObjectNameUtil
.getTransactionName(objectName);
destroyModule(moduleIdentifier);
}
- private void destroyModule(ModuleIdentifier moduleIdentifier) {
+ private synchronized void destroyModule(ModuleIdentifier moduleIdentifier) {
logger.debug("Destroying module {} in transaction {}", moduleIdentifier, this);
transactionStatus.checkNotAborted();
+
+ if (blankTransaction == false) {
+ ModuleInternalTransactionalInfo found =
+ dependencyResolverManager.findModuleInternalTransactionalInfo(moduleIdentifier);
+ if (found.isDefaultBean()) {
+ logger.warn("Warning: removing default bean. This will be forbidden in next version of config-subsystem");
+ }
+ }
ModuleInternalTransactionalInfo removedTInfo = dependencyResolverManager.destroyModule(moduleIdentifier);
// remove from jmx
removedTInfo.getTransactionModuleJMXRegistration().close();
private final OsgiRegistration osgiRegistration;
private final ModuleJMXRegistrator moduleJMXRegistrator;
private final int orderingIdx;
+ private final boolean isDefaultBean;
public ModuleInternalInfo(ModuleIdentifier name,
@Nullable DynamicReadableWrapper readableModule,
OsgiRegistration osgiRegistration,
RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator,
- ModuleJMXRegistrator moduleJMXRegistrator, int orderingIdx) {
+ ModuleJMXRegistrator moduleJMXRegistrator, int orderingIdx,
+ boolean isDefaultBean) {
if (osgiRegistration == null) {
throw new IllegalArgumentException(
this.name = name;
this.moduleJMXRegistrator = moduleJMXRegistrator;
this.orderingIdx = orderingIdx;
+ this.isDefaultBean = isDefaultBean;
}
public DynamicReadableWrapper getReadableModule() {
public ModuleIdentifier getIdentifier() {
return name;
}
+
+ public boolean isDefaultBean() {
+ return isDefaultBean;
+ }
}
@Nullable
private final ModuleInternalInfo maybeOldInternalInfo;
private final TransactionModuleJMXRegistration transactionModuleJMXRegistration;
+ private final boolean isDefaultBean;
ModuleInternalTransactionalInfo(ModuleIdentifier name, Module module,
ModuleFactory moduleFactory,
ModuleInternalInfo maybeOldInternalInfo,
- TransactionModuleJMXRegistration transactionModuleJMXRegistration) {
+ TransactionModuleJMXRegistration transactionModuleJMXRegistration,
+ boolean isDefaultBean) {
this.name = name;
this.module = module;
this.moduleFactory = moduleFactory;
this.maybeOldInternalInfo = maybeOldInternalInfo;
this.transactionModuleJMXRegistration = transactionModuleJMXRegistration;
+ this.isDefaultBean = isDefaultBean;
}
- /**
- * Use {@link #getIdentifier()} instead.
- */
- @Deprecated
- public ModuleIdentifier getName() {
- return name;
- }
-
public boolean hasOldModule() {
return maybeOldInternalInfo != null;
}
public ModuleIdentifier getIdentifier() {
return name;
}
+
+ public boolean isDefaultBean() {
+ return isDefaultBean;
+ }
}
jmxAttributeForReporting);
}
+ @Override
+ public ModuleInternalTransactionalInfo findModuleInternalTransactionalInfo(ModuleIdentifier moduleIdentifier) {
+ return modulesHolder.findModuleInternalTransactionalInfo(moduleIdentifier);
+ }
+
@Override
public ModuleFactory findModuleFactory(ModuleIdentifier moduleIdentifier,
JmxAttribute jmxAttributeForReporting) {
List<ModuleIdentifier> result = new ArrayList<>();
for( ModuleInternalTransactionalInfo info : modulesHolder.getAllInfos()) {
if (factory.equals(info.getModuleFactory())) {
- result.add(info.getName());
+ result.add(info.getIdentifier());
}
}
return result;
public Map<ModuleIdentifier, Module> getAllModules() {
Map<ModuleIdentifier, Module> result = new HashMap<>();
for (ModuleInternalTransactionalInfo entry : commitMap.values()) {
- ModuleIdentifier name = entry.getName();
+ ModuleIdentifier name = entry.getIdentifier();
result.put(name, entry.getModule());
}
return result;
@Override
public void put(
ModuleInternalTransactionalInfo moduleInternalTransactionalInfo) {
- commitMap.put(moduleInternalTransactionalInfo.getName(),
+ commitMap.put(moduleInternalTransactionalInfo.getIdentifier(),
moduleInternalTransactionalInfo);
}
@Override
public ModuleInternalTransactionalInfo destroyModule(
ModuleIdentifier moduleIdentifier) {
- ModuleInternalTransactionalInfo found = commitMap
- .remove(moduleIdentifier);
- if (found == null)
+ ModuleInternalTransactionalInfo found = commitMap.remove(moduleIdentifier);
+ if (found == null) {
throw new IllegalStateException("Not found:" + moduleIdentifier);
+ }
if (found.hasOldModule()) {
unorderedDestroyedFromPreviousTransactions.add(found);
}
public Collection<ModuleInternalTransactionalInfo> getAllInfos(){
return commitMap.values();
}
+
+ @Override
+ public ModuleInternalTransactionalInfo findModuleInternalTransactionalInfo(ModuleIdentifier moduleIdentifier) {
+ ModuleInternalTransactionalInfo found = commitMap.get(moduleIdentifier);
+ if (found == null) {
+ throw new IllegalStateException("Not found:" + moduleIdentifier);
+ }
+ return found;
+ }
}
void assertNotExists(ModuleIdentifier moduleIdentifier)
throws InstanceAlreadyExistsException;
+ ModuleInternalTransactionalInfo findModuleInternalTransactionalInfo(ModuleIdentifier moduleIdentifier);
+
}
for (int i = 0; i < 10; i++) {
try {
// create transaction
- ObjectName tx = configRegistry.beginConfig();
+ boolean blankTransaction = true;
+ ObjectName tx = configRegistry.beginConfig(blankTransaction);
CommitStatus commitStatus = configRegistry.commitConfig(tx);
logger.debug("Committed blank transaction with status {}", commitStatus);
return;
testedTxController = new ConfigTransactionControllerImpl(
transactionName123, jmxRegistrator123, 1, 1,
currentlyRegisteredFactories, transactionsMBeanServer,
- ManagementFactory.getPlatformMBeanServer(), null);
+ ManagementFactory.getPlatformMBeanServer(), false);
TransactionModuleJMXRegistrator transactionModuleJMXRegistrator123 = testedTxController
.getTxModuleJMXRegistrator();
transactionModuleJMXRegistrator123.registerMBean(
private static void mockGetInstance(DependencyResolverManager tested,
ModuleIdentifier moduleIdentifier) {
ModuleInternalTransactionalInfo mock = mock(ModuleInternalTransactionalInfo.class);
- doReturn(moduleIdentifier).when(mock).getName();
+ doReturn(moduleIdentifier).when(mock).getIdentifier();
doReturn(mockedModule()).when(mock).getModule();
tested.put(mock);
}
for (File file : sortedFiles) {
logger.trace("Adding file '{}' to combined result", file);
- final MyLineProcessor lineProcessor = new MyLineProcessor();
+ final MyLineProcessor lineProcessor = new MyLineProcessor(file.getAbsolutePath());
Files.readLines(file, ENCODING, lineProcessor);
modulesBuilder.append(lineProcessor.getModules());
}
class MyLineProcessor implements com.google.common.io.LineProcessor<String> {
+ private final String fileNameForReporting;
private boolean inModules, inServices, inCapabilities;
private final StringBuffer modulesBuffer = new StringBuffer(), servicesBuilder = new StringBuffer();
private final SortedSet<String> caps = new TreeSet<>();
+ MyLineProcessor(String fileNameForReporting) {
+ this.fileNameForReporting = fileNameForReporting;
+ }
+
@Override
public String getResult() {
return null;
return true;
}
+ private void checkFileConsistency(){
+ checkState(inCapabilities, "File {} is missing delimiters in this order: {}", fileNameForReporting,
+ Arrays.asList(DirectoryPersister.MODULES_START,
+ DirectoryPersister.SERVICES_START,
+ DirectoryPersister.CAPABILITIES_START));
+ }
+
String getModules() {
- checkState(inCapabilities);
+ checkFileConsistency();
return modulesBuffer.toString();
}
String getServices() {
- checkState(inCapabilities);
+ checkFileConsistency();
return servicesBuilder.toString();
}
SortedSet<String> getCapabilities() {
- checkState(inCapabilities);
+ checkFileConsistency();
return caps;
}
<Private-Package>
org.opendaylight.controller.config.threadpool.util,
javax.annotation.*,
- org.opendaylight.controller.config.yang.threadpool.impl,
+ org.opendaylight.controller.config.yang.threadpool.impl*,
</Private-Package>
<Export-Package>
org.opendaylight.controller.config.threadpool.util,
+++ /dev/null
-/**
- * Generated file
-
- * Generated from: yang module name: threadpool-impl yang module local name: threadpool-fixed
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 16:19:33 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.threadpool.impl;
-
-/**
-*
-*/
-public class FixedThreadPoolModuleFactory extends
- org.opendaylight.controller.config.yang.threadpool.impl.AbstractFixedThreadPoolModuleFactory {
-
-}
+++ /dev/null
-/**
- * Generated file
-
- * Generated from: yang module name: threadpool-impl yang module local name: threadpool-flexible
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 16:19:33 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.threadpool.impl;
-
-/**
-*
-*/
-public class FlexibleThreadPoolModuleFactory extends
- org.opendaylight.controller.config.yang.threadpool.impl.AbstractFlexibleThreadPoolModuleFactory {
-
-}
+++ /dev/null
-/**
- * Generated file
-
- * Generated from: yang module name: threadpool-impl yang module local name: threadpool-scheduled
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 16:19:33 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.threadpool.impl;
-
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper;
-
-/**
-*
-*/
-public final class ScheduledThreadPoolModule extends
- org.opendaylight.controller.config.yang.threadpool.impl.AbstractScheduledThreadPoolModule {
-
- public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
- ScheduledThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void validate() {
- super.validate();
- JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute);
- JmxAttributeValidationException.checkCondition(getMaxThreadCount() > 0, "must be greater than zero",
- maxThreadCountJmxAttribute);
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new ScheduledThreadPoolWrapper(getMaxThreadCount(), getThreadFactoryDependency());
- }
-}
+++ /dev/null
-/**
- * Generated file
-
- * Generated from: yang module name: threadpool-impl yang module local name: threadpool-scheduled
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 16:19:33 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.threadpool.impl;
-
-/**
-*
-*/
-public class ScheduledThreadPoolModuleFactory extends
- org.opendaylight.controller.config.yang.threadpool.impl.AbstractScheduledThreadPoolModuleFactory {
-
-}
/**
- * Generated file
+* Generated file
- * Generated from: yang module name: threadpool-impl yang module local name: threadpool-fixed
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 16:19:33 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.threadpool.impl;
+* Generated from: yang module name: threadpool-impl-fixed yang module local name: threadpool-fixed
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sun Dec 01 17:13:32 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.threadpool.impl.fixed;
import org.opendaylight.controller.config.api.JmxAttributeValidationException;
import org.opendaylight.controller.config.threadpool.util.FixedThreadPoolWrapper;
/**
*
*/
-public final class FixedThreadPoolModule extends
- org.opendaylight.controller.config.yang.threadpool.impl.AbstractFixedThreadPoolModule {
+public final class FixedThreadPoolModule extends org.opendaylight.controller.config.yang.threadpool.impl.fixed.AbstractFixedThreadPoolModule
+{
- public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
- public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
- FixedThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
+ public FixedThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, FixedThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
super(identifier, dependencyResolver, oldModule, oldInstance);
}
@Override
- public void validate() {
+ public void validate(){
super.validate();
JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute);
--- /dev/null
+/**
+* Generated file
+
+* Generated from: yang module name: threadpool-impl-fixed yang module local name: threadpool-fixed
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sun Dec 01 17:13:32 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.threadpool.impl.fixed;
+
+/**
+*
+*/
+public class FixedThreadPoolModuleFactory extends org.opendaylight.controller.config.yang.threadpool.impl.fixed.AbstractFixedThreadPoolModuleFactory
+{
+
+
+}
/**
- * Generated file
+* Generated file
- * Generated from: yang module name: threadpool-impl yang module local name: threadpool-flexible
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 16:19:33 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.threadpool.impl;
+* Generated from: yang module name: threadpool-impl-flexible yang module local name: threadpool-flexible
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sun Dec 01 17:13:32 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.threadpool.impl.flexible;
import java.util.concurrent.TimeUnit;
/**
*
*/
-public final class FlexibleThreadPoolModule extends
- org.opendaylight.controller.config.yang.threadpool.impl.AbstractFlexibleThreadPoolModule {
+public final class FlexibleThreadPoolModule extends org.opendaylight.controller.config.yang.threadpool.impl.flexible.AbstractFlexibleThreadPoolModule
+{
- public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
- public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
- FlexibleThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
+ public FlexibleThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, FlexibleThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
super(identifier, dependencyResolver, oldModule, oldInstance);
}
@Override
- public void validate() {
+ public void validate(){
super.validate();
JmxAttributeValidationException.checkNotNull(getKeepAliveMillis(), keepAliveMillisJmxAttribute);
JmxAttributeValidationException.checkCondition(getKeepAliveMillis() > 0, "must be greater than zero",
--- /dev/null
+/**
+* Generated file
+
+* Generated from: yang module name: threadpool-impl-flexible yang module local name: threadpool-flexible
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sun Dec 01 17:13:32 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.threadpool.impl.flexible;
+
+/**
+*
+*/
+public class FlexibleThreadPoolModuleFactory extends org.opendaylight.controller.config.yang.threadpool.impl.flexible.AbstractFlexibleThreadPoolModuleFactory
+{
+
+
+}
--- /dev/null
+/**
+* Generated file
+
+* Generated from: yang module name: threadpool-impl-scheduled yang module local name: threadpool-scheduled
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sun Dec 01 17:13:32 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.threadpool.impl.scheduled;
+
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
+import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper;
+
+/**
+*
+*/
+public final class ScheduledThreadPoolModule extends org.opendaylight.controller.config.yang.threadpool.impl.scheduled.AbstractScheduledThreadPoolModule
+{
+
+ public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public ScheduledThreadPoolModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, ScheduledThreadPoolModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void validate(){
+ super.validate();
+ JmxAttributeValidationException.checkNotNull(getMaxThreadCount(), maxThreadCountJmxAttribute);
+ JmxAttributeValidationException.checkCondition(getMaxThreadCount() > 0, "must be greater than zero",
+ maxThreadCountJmxAttribute);
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ return new ScheduledThreadPoolWrapper(getMaxThreadCount(), getThreadFactoryDependency());
+ }
+}
--- /dev/null
+/**
+* Generated file
+
+* Generated from: yang module name: threadpool-impl-scheduled yang module local name: threadpool-scheduled
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sun Dec 01 17:13:32 CET 2013
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.threadpool.impl.scheduled;
+
+/**
+*
+*/
+public class ScheduledThreadPoolModuleFactory extends org.opendaylight.controller.config.yang.threadpool.impl.scheduled.AbstractScheduledThreadPoolModuleFactory
+{
+
+
+}
--- /dev/null
+module threadpool-impl-fixed {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:fixed";
+ prefix "th-java-fixed";
+
+ import threadpool { prefix th; revision-date 2013-04-09; }
+ import config { prefix config; revision-date 2013-04-05; }
+ import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+
+ organization "Cisco Systems, Inc.";
+
+ contact "Robert Varga <rovarga@cisco.com>";
+
+ description
+ "This module contains the base YANG definitions for
+ thread services pure Java implementation.
+
+ Copyright (c)2013 Cisco Systems, Inc. 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";
+
+ revision "2013-12-01" {
+ description
+ "Initial revision";
+ }
+
+
+ identity threadpool-fixed {
+ base config:module-type;
+ config:provided-service th:threadpool;
+ config:java-name-prefix FixedThreadPool;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case threadpool-fixed {
+ when "/config:modules/config:module/config:type = 'threadpool-fixed'";
+ leaf max-thread-count {
+ type uint16;
+ }
+
+ container threadFactory {
+ uses config:service-ref {
+ refine type {
+ //mandatory true;
+ config:required-identity th:threadfactory;
+ }
+ }
+ }
+ }
+ }
+}
+
--- /dev/null
+module threadpool-impl-flexible {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:flexible";
+ prefix "th-java-flexible";
+
+ import threadpool { prefix th; revision-date 2013-04-09; }
+ import config { prefix config; revision-date 2013-04-05; }
+ import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+
+ organization "Cisco Systems, Inc.";
+
+ contact "Robert Varga <rovarga@cisco.com>";
+
+ description
+ "This module contains the base YANG definitions for
+ thread services pure Java implementation.
+
+ Copyright (c)2013 Cisco Systems, Inc. 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";
+
+ revision "2013-12-01" {
+ description
+ "Initial revision";
+ }
+
+ identity threadpool-flexible {
+ base config:module-type;
+ config:provided-service th:threadpool;
+ config:java-name-prefix FlexibleThreadPool;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case threadpool-flexible {
+ when "/config:modules/config:module/config:type = 'threadpool-flexible'";
+ leaf max-thread-count {
+ type uint16;
+ }
+ leaf minThreadCount {
+ type uint16;
+ }
+ leaf keepAliveMillis {
+ type uint32;
+ }
+
+ container threadFactory {
+ uses config:service-ref {
+ refine type {
+ // mandatory true;
+ config:required-identity th:threadfactory;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+module threadpool-impl-scheduled {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:scheduled";
+ prefix "th-java-scheduled";
+
+ import threadpool { prefix th; revision-date 2013-04-09; }
+ import config { prefix config; revision-date 2013-04-05; }
+ import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+
+ organization "Cisco Systems, Inc.";
+
+ contact "Robert Varga <rovarga@cisco.com>";
+
+ description
+ "This module contains the base YANG definitions for
+ thread services pure Java implementation.
+
+ Copyright (c)2013 Cisco Systems, Inc. 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";
+
+ revision "2013-12-01" {
+ description
+ "Initial revision";
+ }
+
+ identity threadpool-scheduled {
+ base config:module-type;
+ config:provided-service th:scheduled-threadpool;
+ config:java-name-prefix ScheduledThreadPool;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case threadpool-scheduled {
+ when "/config:modules/config:module/config:type = 'threadpool-scheduled'";
+ leaf max-thread-count {
+ type uint16;
+ }
+
+ container threadFactory {
+ uses config:service-ref {
+ refine type {
+ // mandatory true;
+ config:required-identity th:threadfactory;
+ }
+ }
+ }
+ }
+ }
+}
-// vi: set smarttab et sw=4 tabstop=4:
module threadpool-impl {
yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl";
thread services pure Java implementation.
Copyright (c)2013 Cisco Systems, Inc. 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";
+ 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";
revision "2013-04-05" {
description
config:java-name-prefix EventBus;
}
- augment "/config:modules/config:module/config:configuration" {
- case eventbus {
- when "/config:modules/config:module/config:type = 'eventbus'";
- // No real configuration
+ augment "/config:modules/config:module/config:configuration" {
+ case eventbus {
+ when "/config:modules/config:module/config:type = 'eventbus'";
+ // No real configuration
}
}
- augment "/config:modules/config:module/config:state" {
- case eventbus {
- when "/config:modules/config:module/config:type = 'eventbus'";
- rpcx:rpc-context-instance "event-bus-rpc";
+ augment "/config:modules/config:module/config:state" {
+ case eventbus {
+ when "/config:modules/config:module/config:type = 'eventbus'";
+ rpcx:rpc-context-instance "event-bus-rpc";
}
}
- identity event-bus-rpc;
+ identity event-bus-rpc;
identity async-eventbus {
base config:module-type;
config:java-name-prefix AsyncEventBus;
}
- augment "/config:modules/config:module/config:configuration" {
- case async-eventbus {
- when "/config:modules/config:module/config:type = 'async-eventbus'";
- container threadpool {
- uses config:service-ref {
- refine type {
- //mandatory true;
- config:required-identity th:threadpool;
- }
- }
- }
- }
- }
-
- augment "/config:modules/config:module/config:state" {
- case async-eventbus {
- when "/config:modules/config:module/config:type = 'async-eventbus'";
- rpcx:rpc-context-instance "event-bus-rpc";
+ augment "/config:modules/config:module/config:configuration" {
+ case async-eventbus {
+ when "/config:modules/config:module/config:type = 'async-eventbus'";
+ container threadpool {
+ uses config:service-ref {
+ refine type {
+ //mandatory true;
+ config:required-identity th:threadpool;
+ }
+ }
+ }
}
}
- rpc get-dead-events-count {
- config:java-name-prefix countDeadEvents;
- input {
- uses rpcx:rpc-context-ref {
- refine context-instance {
- rpcx:rpc-context-instance event-bus-rpc;
- }
- }
- }
- output {
- leaf result {
- type uint32;
- }
- }
- }
-
- identity threadfactory-naming {
- base config:module-type;
- config:provided-service th:threadfactory;
- config:java-name-prefix NamingThreadFactory;
+ augment "/config:modules/config:module/config:state" {
+ case async-eventbus {
+ when "/config:modules/config:module/config:type = 'async-eventbus'";
+ rpcx:rpc-context-instance "event-bus-rpc";
+ }
}
- augment "/config:modules/config:module/config:configuration" {
- case threadfactory-naming {
- when "/config:modules/config:module/config:type = 'threadfactory-naming'";
- leaf name-prefix {
- type string;
- }
+ rpc get-dead-events-count {
+ config:java-name-prefix countDeadEvents;
+ input {
+ uses rpcx:rpc-context-ref {
+ refine context-instance {
+ rpcx:rpc-context-instance event-bus-rpc;
+ }
+ }
+ }
+ output {
+ leaf result {
+ type uint32;
+ }
}
}
- identity threadpool-fixed {
- base config:module-type;
- config:provided-service th:threadpool;
- config:java-name-prefix FixedThreadPool;
+ identity threadfactory-naming {
+ base config:module-type;
+ config:provided-service th:threadfactory;
+ config:java-name-prefix NamingThreadFactory;
}
- augment "/config:modules/config:module/config:configuration" {
- case threadpool-fixed {
- when "/config:modules/config:module/config:type = 'threadpool-fixed'";
- leaf max-thread-count {
- type uint16;
- }
-
- container threadFactory {
- uses config:service-ref {
- refine type {
- //mandatory true;
- config:required-identity th:threadfactory;
- }
- }
- }
+ augment "/config:modules/config:module/config:configuration" {
+ case threadfactory-naming {
+ when "/config:modules/config:module/config:type = 'threadfactory-naming'";
+ leaf name-prefix {
+ type string;
+ }
}
- }
-
- identity threadpool-flexible {
- base config:module-type;
- config:provided-service th:threadpool;
- config:java-name-prefix FlexibleThreadPool;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case threadpool-flexible {
- when "/config:modules/config:module/config:type = 'threadpool-flexible'";
- leaf max-thread-count {
- type uint16;
- }
- leaf minThreadCount {
- type uint16;
- }
- leaf keepAliveMillis {
- type uint32;
- }
-
- container threadFactory {
- uses config:service-ref {
- refine type {
- // mandatory true;
- config:required-identity th:threadfactory;
- }
- }
- }
- }
- }
-
- identity threadpool-scheduled {
- base config:module-type;
- config:provided-service th:scheduled-threadpool;
- config:java-name-prefix ScheduledThreadPool;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case threadpool-scheduled {
- when "/config:modules/config:module/config:type = 'threadpool-scheduled'";
- leaf max-thread-count {
- type uint16;
- }
-
- container threadFactory {
- uses config:service-ref {
- refine type {
- // mandatory true;
- config:required-identity th:threadfactory;
- }
- }
- }
- }
- }
+ }
}
package org.opendaylight.controller.config.threadpool.fixed;\r
\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.fail;\r
-import static org.junit.matchers.JUnitMatchers.containsString;\r
-\r
-import javax.management.InstanceAlreadyExistsException;\r
-import javax.management.InstanceNotFoundException;\r
-import javax.management.ObjectName;\r
-\r
import org.junit.Before;\r
import org.junit.Test;\r
import org.opendaylight.controller.config.api.ConflictingVersionException;\r
import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.FixedThreadPoolModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.FixedThreadPoolModuleMXBean;\r
import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.fixed.FixedThreadPoolModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.fixed.FixedThreadPoolModuleMXBean;\r
+\r
+import javax.management.InstanceAlreadyExistsException;\r
+import javax.management.InstanceNotFoundException;\r
+import javax.management.ObjectName;\r
+\r
+import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.fail;\r
+import static org.junit.matchers.JUnitMatchers.containsString;\r
\r
public class FixedThreadPoolConfigBeanTest extends AbstractConfigTest {\r
\r
package org.opendaylight.controller.config.threadpool.flexible;\r
\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.fail;\r
-import static org.junit.matchers.JUnitMatchers.containsString;\r
-\r
-import javax.management.InstanceAlreadyExistsException;\r
-import javax.management.InstanceNotFoundException;\r
-import javax.management.ObjectName;\r
-\r
import org.junit.Before;\r
import org.junit.Test;\r
import org.opendaylight.controller.config.api.ConflictingVersionException;\r
import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;\r
import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;\r
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.FlexibleThreadPoolModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.FlexibleThreadPoolModuleMXBean;\r
import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.flexible.FlexibleThreadPoolModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.flexible.FlexibleThreadPoolModuleMXBean;\r
+\r
+import javax.management.InstanceAlreadyExistsException;\r
+import javax.management.InstanceNotFoundException;\r
+import javax.management.ObjectName;\r
+\r
+import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.fail;\r
+import static org.junit.matchers.JUnitMatchers.containsString;\r
\r
public class FlexibleThreadPoolConfigBeanTest extends AbstractConfigTest {\r
\r
package org.opendaylight.controller.config.threadpool.scheduled;\r
\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertThat;\r
-import static org.junit.Assert.assertTrue;\r
-import static org.junit.Assert.fail;\r
-import static org.junit.matchers.JUnitMatchers.containsString;\r
-\r
-import javax.management.InstanceAlreadyExistsException;\r
-import javax.management.InstanceNotFoundException;\r
-import javax.management.ObjectName;\r
-\r
import org.junit.Before;\r
import org.junit.Test;\r
import org.opendaylight.controller.config.api.ConflictingVersionException;\r
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;\r
import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleFactory;\r
import org.opendaylight.controller.config.yang.threadpool.impl.NamingThreadFactoryModuleMXBean;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.ScheduledThreadPoolModuleFactory;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.ScheduledThreadPoolModuleMXBean;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleFactory;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleMXBean;\r
+\r
+import javax.management.InstanceAlreadyExistsException;\r
+import javax.management.InstanceNotFoundException;\r
+import javax.management.ObjectName;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertThat;\r
+import static org.junit.Assert.assertTrue;\r
+import static org.junit.Assert.fail;\r
+import static org.junit.matchers.JUnitMatchers.containsString;\r
\r
public class ScheduledThreadPoolConfigBeanTest extends AbstractConfigTest {\r
\r
package org.opendaylight.controller.config.threadpool.scheduled;\r
\r
-import static org.mockito.Matchers.any;\r
-import static org.mockito.Matchers.anyBoolean;\r
-import static org.mockito.Matchers.anyLong;\r
-import static org.mockito.Mockito.doNothing;\r
-import static org.mockito.Mockito.doReturn;\r
-import static org.mockito.Mockito.mock;\r
-\r
-import java.util.concurrent.ScheduledExecutorService;\r
-import java.util.concurrent.ScheduledFuture;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import javax.management.ObjectName;\r
-\r
+import com.google.common.util.concurrent.ListenableFutureTask;\r
import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;\r
import org.opendaylight.controller.config.api.ModuleIdentifier;\r
import org.opendaylight.controller.config.manager.impl.AbstractMockedModule;\r
import org.opendaylight.controller.config.spi.Module;\r
import org.opendaylight.controller.config.threadpool.util.ScheduledThreadPoolWrapper;\r
import org.opendaylight.controller.config.yang.threadpool.ScheduledThreadPoolServiceInterface;\r
-import org.opendaylight.controller.config.yang.threadpool.impl.ScheduledThreadPoolModuleMXBean;\r
+import org.opendaylight.controller.config.yang.threadpool.impl.scheduled.ScheduledThreadPoolModuleMXBean;\r
\r
-import com.google.common.util.concurrent.ListenableFutureTask;\r
+import javax.management.ObjectName;\r
+import java.util.concurrent.ScheduledExecutorService;\r
+import java.util.concurrent.ScheduledFuture;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import static org.mockito.Matchers.any;\r
+import static org.mockito.Matchers.anyBoolean;\r
+import static org.mockito.Matchers.anyLong;\r
+import static org.mockito.Mockito.doNothing;\r
+import static org.mockito.Mockito.doReturn;\r
+import static org.mockito.Mockito.mock;\r
\r
public class TestingScheduledThreadPoolModule extends AbstractMockedModule implements\r
ScheduledThreadPoolServiceInterface, Module, ScheduledThreadPoolModuleMXBean {\r
netconf.config.persister.2.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.FileStorageAdapter
netconf.config.persister.2.properties.fileStorage=configuration/current/controller.currentconfig.txt
+netconf.config.persister.2.properties.numberOfBackups=1
yangstore.blacklist=.*controller.model.*
--- /dev/null
+//MODULES START
+ <module>
+ <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty:threadgroup">netty:netty-threadgroup-fixed</type>
+ <name>global-boss-group</name>
+ </module>
+ <module>
+ <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty:threadgroup">netty:netty-threadgroup-fixed</type>
+ <name>global-worker-group</name>
+ </module>
+ <module>
+ <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty:timer">netty:netty-hashed-wheel-timer</type>
+ <name>global-timer</name>
+ </module>
+ <module>
+ <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty:eventexecutor">netty:netty-global-event-executor</type>
+ <name>global-event-executor</name>
+ </module>
+//SERVICES START
+ <service>
+ <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-threadgroup</type>
+ <instance>
+ <name>global-boss-group</name>
+ <provider>/config/modules/module[name='netty-threadgroup-fixed']/instance[name='global-boss-group']</provider>
+ </instance>
+ <instance>
+ <name>global-worker-group</name>
+ <provider>/config/modules/module[name='netty-threadgroup-fixed']/instance[name='global-worker-group']</provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-event-executor</type>
+ <instance>
+ <name>global-event-executor</name>
+ <provider>/config/modules/module[name='netty-global-eventexecutor']/instance[name='global-event-executor']</provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:netty="urn:opendaylight:params:xml:ns:yang:controller:netty">netty:netty-timer</type>
+ <instance>
+ <name>global-timer</name>
+ <provider>/config/modules/module[name='netty-hashed-wheel-timer']/instance[name='global-timer']</provider>
+ </instance>
+ </service>
+//CAPABILITIES START
+urn:opendaylight:params:xml:ns:yang:controller:netty?module=netty&revision=2013-11-19
+urn:opendaylight:params:xml:ns:yang:controller:netty:eventexecutor?module=netty-event-executor&revision=2013-11-12
+urn:opendaylight:params:xml:ns:yang:controller:netty:threadgroup?module=threadgroup&revision=2013-11-07
+urn:opendaylight:params:xml:ns:yang:controller:netty:timer?module=netty-timer&revision=2013-11-19
+++ /dev/null
-//MODULES START
-//SERVICES START
-
-//CAPABILITIES START
-urn:opendaylight:params:xml:ns:yang:controller:logback:config?module=config-logging&revision=2013-07-16
private URI namespace;
private QName name;
private List<NodeWrapper<?>> values = new ArrayList<>();
-
+
public CompositeNodeWrapper(String localName) {
this.localName = Preconditions.checkNotNull(localName);
}
-
+
public CompositeNodeWrapper(URI namespace, String localName) {
this(localName);
this.namespace = namespace;
}
@Override
- public CompositeNode unwrap(CompositeNode parent) {
+ public CompositeNode unwrap() {
if (compositeNode == null) {
if (name == null) {
Preconditions.checkNotNull(namespace);
name = new QName(namespace, localName);
}
- compositeNode = NodeFactory.createMutableCompositeNode(name, parent, new ArrayList<Node<?>>(), null, null);
List<Node<?>> nodeValues = new ArrayList<>();
for (NodeWrapper<?> nodeWrapper : values) {
- nodeValues.add(nodeWrapper.unwrap(compositeNode));
+ nodeValues.add(nodeWrapper.unwrap());
}
- compositeNode.setValue(nodeValues);
+ compositeNode = NodeFactory.createMutableCompositeNode(name, null, nodeValues, null, null);
values = null;
namespace = null;
@Override
public QName getNodeType() {
- return unwrap(null).getNodeType();
+ return unwrap().getNodeType();
}
@Override
public CompositeNode getParent() {
- return unwrap(null).getParent();
+ return unwrap().getParent();
}
@Override
public List<Node<?>> getValue() {
- return unwrap(null).getValue();
+ return unwrap().getValue();
}
@Override
public ModifyAction getModificationAction() {
- return unwrap(null).getModificationAction();
+ return unwrap().getModificationAction();
}
@Override
public List<Node<?>> getChildren() {
- return unwrap(null).getChildren();
+ return unwrap().getChildren();
}
@Override
public List<CompositeNode> getCompositesByName(QName children) {
- return unwrap(null).getCompositesByName(children);
+ return unwrap().getCompositesByName(children);
}
@Override
public List<CompositeNode> getCompositesByName(String children) {
- return unwrap(null).getCompositesByName(children);
+ return unwrap().getCompositesByName(children);
}
@Override
public List<SimpleNode<?>> getSimpleNodesByName(QName children) {
- return unwrap(null).getSimpleNodesByName(children);
+ return unwrap().getSimpleNodesByName(children);
}
@Override
public List<SimpleNode<?>> getSimpleNodesByName(String children) {
- return unwrap(null).getSimpleNodesByName(children);
+ return unwrap().getSimpleNodesByName(children);
}
@Override
public CompositeNode getFirstCompositeByName(QName container) {
- return unwrap(null).getFirstCompositeByName(container);
+ return unwrap().getFirstCompositeByName(container);
}
@Override
public SimpleNode<?> getFirstSimpleByName(QName leaf) {
- return unwrap(null).getFirstSimpleByName(leaf);
+ return unwrap().getFirstSimpleByName(leaf);
}
@Override
public MutableCompositeNode asMutable() {
- return unwrap(null).asMutable();
+ return unwrap().asMutable();
}
@Override
public QName getKey() {
- return unwrap(null).getKey();
+ return unwrap().getKey();
}
@Override
public List<Node<?>> setValue(List<Node<?>> value) {
- return unwrap(null).setValue(value);
+ return unwrap().setValue(value);
}
@Override
public int size() {
- return unwrap(null).size();
+ return unwrap().size();
}
@Override
public boolean isEmpty() {
- return unwrap(null).isEmpty();
+ return unwrap().isEmpty();
}
@Override
public boolean containsKey(Object key) {
- return unwrap(null).containsKey(key);
+ return unwrap().containsKey(key);
}
@Override
public boolean containsValue(Object value) {
- return unwrap(null).containsValue(value);
+ return unwrap().containsValue(value);
}
@Override
public List<Node<?>> get(Object key) {
- return unwrap(null).get(key);
+ return unwrap().get(key);
}
@Override
public List<Node<?>> put(QName key, List<Node<?>> value) {
- return unwrap(null).put(key, value);
+ return unwrap().put(key, value);
}
@Override
public List<Node<?>> remove(Object key) {
- return unwrap(null).remove(key);
+ return unwrap().remove(key);
}
@Override
public void putAll(Map<? extends QName, ? extends List<Node<?>>> m) {
- unwrap(null).putAll(m);
+ unwrap().putAll(m);
}
@Override
public void clear() {
- unwrap(null).clear();
+ unwrap().clear();
}
@Override
public Set<QName> keySet() {
- return unwrap(null).keySet();
+ return unwrap().keySet();
}
@Override
public Collection<List<Node<?>>> values() {
- return unwrap(null).values();
+ return unwrap().values();
}
@Override
public Set<java.util.Map.Entry<QName, List<Node<?>>>> entrySet() {
- return unwrap(null).entrySet();
+ return unwrap().entrySet();
}
}
val static NULL_VALUE = "null"
- @Property
- SchemaContext schemas;
+ var SchemaContext schemas;
private val BiMap<URI, String> uriToModuleName = HashBiMap.create();
private val Map<String, URI> moduleNameToUri = uriToModuleName.inverse();
}
}
+ def setSchemas(SchemaContext schemas) {
+ onGlobalContextUpdated(schemas)
+ }
+
public def InstanceIdWithSchemaNode toInstanceIdentifier(String restconfInstance) {
val ret = InstanceIdentifier.builder();
val pathArgs = restconfInstance.split("/");
if (schemaNode === null) {
return null
}
- new InstanceIdWithSchemaNode(ret.toInstance, schemaNode)
+ return new InstanceIdWithSchemaNode(ret.toInstance, schemaNode)
}
private def findModule(String restconfInstance) {
}
val modulWithFirstYangStatement = pathArgs.filter[s|s.contains(":")].head
val startModule = modulWithFirstYangStatement.toModuleName();
- schemas.getLatestModule(startModule)
+ return getLatestModule(startModule)
}
- private def getLatestModule(SchemaContext schema, String moduleName) {
- checkNotNull(schema)
+ private def getLatestModule(String moduleName) {
+ checkPreconditions
checkArgument(moduleName !== null && !moduleName.empty)
- val modules = schema.modules.filter[m|m.name == moduleName]
+ val modules = schemas.modules.filter[m|m.name == moduleName]
var latestModule = modules.head
for (module : modules) {
if (module.revision.after(latestModule.revision)) {
return str;
}
}
-
- public def QName toQName(String name) {
+
+ private def QName toQName(String name) {
val module = name.toModuleName;
val node = name.toNodeName;
val namespace = moduleNameToUri.get(module);
return new QName(namespace,null,node);
}
+
+ def getRpcDefinition(String name) {
+ return qnameToRpc.get(name.toQName)
+ }
override onGlobalContextUpdated(SchemaContext context) {
this.schemas = context;
}
}
- def ContainerSchemaNode getRpcOutputSchema(QName name) {
- qnameToRpc.get(name)?.output;
- }
-
- def ContainerSchemaNode getRpcInputSchema(QName name) {
- qnameToRpc.get(name)?.input;
- }
-
}
import java.net.URI;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
import org.opendaylight.yangtools.yang.data.api.Node;
public interface NodeWrapper<T extends Node<?>> {
void setQname(QName name);
- T unwrap(CompositeNode parent);
+ T unwrap();
URI getNamespace();
package org.opendaylight.controller.sal.restconf.impl
+import java.util.ArrayList
import java.util.List
import java.util.Set
import javax.ws.rs.core.Response
import org.opendaylight.controller.md.sal.common.api.TransactionStatus
import org.opendaylight.controller.sal.rest.api.RestconfService
import org.opendaylight.yangtools.yang.data.api.CompositeNode
+import org.opendaylight.yangtools.yang.data.api.Node
+import org.opendaylight.yangtools.yang.data.impl.NodeFactory
import org.opendaylight.yangtools.yang.model.api.ChoiceNode
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode
}
override invokeRpc(String identifier, CompositeNode payload) {
- val rpc = identifier.toQName;
- val value = resolveNodeNamespaceBySchema(payload, controllerContext.getRpcInputSchema(rpc))
- val rpcResult = broker.invokeRpc(rpc, value);
- val schema = controllerContext.getRpcOutputSchema(rpc);
- return new StructuredData(rpcResult.result, schema);
+ val rpc = identifier.rpcDefinition
+ if (rpc === null) {
+ throw new ResponseException(Response.Status.NOT_FOUND, "RPC does not exist.");
+ }
+ val value = resolveNodeNamespaceBySchema(payload, rpc.input)
+ val List<Node<?>> input = new ArrayList
+ input.add(value)
+ val rpcRequest = NodeFactory.createMutableCompositeNode(rpc.QName, null, input, null, null)
+ val rpcResult = broker.invokeRpc(rpc.QName, rpcRequest);
+ return new StructuredData(rpcResult.result, rpc.output);
}
override readConfigurationData(String identifier) {
private def CompositeNode resolveNodeNamespaceBySchema(CompositeNode node, DataSchemaNode schema) {
if (node instanceof CompositeNodeWrapper) {
addNamespaceToNodeFromSchemaRecursively(node as CompositeNodeWrapper, schema)
- return (node as CompositeNodeWrapper).unwrap(null)
+ return (node as CompositeNodeWrapper).unwrap()
}
return node
}
}
@Override
- public SimpleNode<String> unwrap(CompositeNode parent) {
+ public SimpleNode<String> unwrap() {
if (simpleNode == null) {
if (name == null) {
Preconditions.checkNotNull(namespace);
name = new QName(namespace, localName);
}
- simpleNode = NodeFactory.createImmutableSimpleNode(name, parent, value);
+ simpleNode = NodeFactory.createImmutableSimpleNode(name, null, value);
value = null;
namespace = null;
@Override
public QName getNodeType() {
- return unwrap(null).getNodeType();
+ return unwrap().getNodeType();
}
@Override
public CompositeNode getParent() {
- return unwrap(null).getParent();
+ return unwrap().getParent();
}
@Override
public String getValue() {
- return unwrap(null).getValue();
+ return unwrap().getValue();
}
@Override
public ModifyAction getModificationAction() {
- return unwrap(null).getModificationAction();
+ return unwrap().getModificationAction();
}
@Override
public MutableSimpleNode<String> asMutable() {
- return unwrap(null).asMutable();
+ return unwrap().asMutable();
}
@Override
public QName getKey() {
- return unwrap(null).getKey();
+ return unwrap().getKey();
}
@Override
public String setValue(String value) {
- return unwrap(null).setValue(value);
+ return unwrap().setValue(value);
}
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.concurrent.*;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.util.List;
import javax.ws.rs.WebApplicationException;
-import org.junit.*;
+import org.junit.Test;
import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
-import org.opendaylight.controller.sal.restconf.impl.*;
-import org.opendaylight.yangtools.yang.data.api.*;
-import org.slf4j.*;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.model.api.*;
+import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
+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.model.api.DataSchemaNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.JsonSyntaxException;
TestUtils.supplementNamespace(dataSchemaNode1, compositeNode);
assertTrue(compositeNode instanceof CompositeNodeWrapper);
- CompositeNode compNode = ((CompositeNodeWrapper) compositeNode).unwrap(null);
+ CompositeNode compNode = ((CompositeNodeWrapper) compositeNode).unwrap();
assertEquals("lst", compNode.getNodeType().getLocalName());
verifyCompositeNode(compNode, "simple:list:yang1");
TestUtils.supplementNamespace(dataSchemaNode, compositeNode);
assertTrue(compositeNode instanceof CompositeNodeWrapper);
- CompositeNode compNode = ((CompositeNodeWrapper) compositeNode).unwrap(null);
+ CompositeNode compNode = ((CompositeNodeWrapper) compositeNode).unwrap();
assertEquals(topLevelElementName, compNode.getNodeType().getLocalName());
verifyCompositeNode(compNode, namespace);
if (dummyNamespaces) {
try {
TestUtils.addDummyNamespaceToAllNodes((CompositeNodeWrapper) compositeNode);
- return ((CompositeNodeWrapper) compositeNode).unwrap(null);
+ return ((CompositeNodeWrapper) compositeNode).unwrap();
} catch (URISyntaxException e) {
LOG.error(e.getMessage());
assertTrue(e.getMessage(), false);
if (dummyNamespaces) {
try {
TestUtils.addDummyNamespaceToAllNodes((CompositeNodeWrapper) compositeNode);
- return ((CompositeNodeWrapper) compositeNode).unwrap(null);
+ return ((CompositeNodeWrapper) compositeNode).unwrap();
} catch (URISyntaxException e) {
LOG.error(e.getMessage());
assertTrue(e.getMessage(), false);
// Socket should not be closed at this point
// Activator unregisters this as JMX listener before close is called
- logger.debug("Received notification {}", notification);
+ logger.info("Received notification {}", notification);
if (notification instanceof CommitJMXNotification) {
try {
handleAfterCommitNotification((CommitJMXNotification) notification);
try {
persister.persistConfig(new CapabilityStrippingConfigSnapshotHolder(notification.getConfigSnapshot(),
notification.getCapabilities(), ignoredMissingCapabilityRegex));
- logger.debug("Configuration persisted successfully");
+ logger.info("Configuration persisted successfully");
} catch (IOException e) {
throw new RuntimeException("Unable to persist configuration snapshot", e);
}
return ans;
}
+ @Override
+ public String toString() {
+ return "NeutronNetwork [networkUUID=" + networkUUID + ", networkName=" + networkName + ", adminStateUp="
+ + adminStateUp + ", shared=" + shared + ", tenantID=" + tenantID + ", routerExternal=" + routerExternal
+ + ", providerNetworkType=" + providerNetworkType + ", providerPhysicalNetwork="
+ + providerPhysicalNetwork + ", providerSegmentationID=" + providerSegmentationID + ", status=" + status
+ + ", subnets=" + subnets + ", myPorts=" + myPorts + "]";
+ }
}
public boolean isBoundToFloatingIP(String fixedIP) {
return floatingIPMap.containsKey(fixedIP);
}
+
+ @Override
+ public String toString() {
+ return "NeutronPort [portUUID=" + portUUID + ", networkUUID=" + networkUUID + ", name=" + name
+ + ", adminStateUp=" + adminStateUp + ", status=" + status + ", macAddress=" + macAddress
+ + ", fixedIPs=" + fixedIPs + ", deviceID=" + deviceID + ", deviceOwner=" + deviceOwner + ", tenantID="
+ + tenantID + ", floatingIPMap=" + floatingIPMap + "]";
+ }
}
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
public void resetGatewayIPAllocated() {
gatewayIPAssigned = false;
}
+
+ @Override
+ public String toString() {
+ return "NeutronSubnet [subnetUUID=" + subnetUUID + ", networkUUID=" + networkUUID + ", name=" + name
+ + ", ipVersion=" + ipVersion + ", cidr=" + cidr + ", gatewayIP=" + gatewayIP + ", dnsNameservers="
+ + dnsNameservers + ", allocationPools=" + allocationPools + ", hostRoutes=" + hostRoutes
+ + ", enableDHCP=" + enableDHCP + ", tenantID=" + tenantID + ", myPorts=" + myPorts
+ + ", gatewayIPAssigned=" + gatewayIPAssigned + "]";
+ }
}
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
- <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>