Class<? extends AbstractServiceInterface> expectedServiceInterface,
ObjectName objectName, JmxAttribute jmxAttribute);
- @Deprecated
- // TODO remove once all config code is generated
- void validateDependency(
- Class<? extends AbstractServiceInterface> expectedServiceInterface,
- ObjectName objectName, String attributeNameForErrorReporting);
-
/**
* To be used during commit phase to wire actual dependencies.
*
<T> T resolveInstance(Class<T> expectedType, ObjectName objectName,
JmxAttribute jmxAttribute);
- @Deprecated
- <T> T resolveInstance(Class<T> expectedType, ObjectName objectName);
-
}
}
}
- @Override
- public void validateDependency(
- Class<? extends AbstractServiceInterface> expectedServiceInterface,
- ObjectName objectName, String attributeNameForErrorReporting) {
- validateDependency(expectedServiceInterface, objectName,
- new JmxAttribute(attributeNameForErrorReporting));
- }
-
/**
* {@inheritDoc}
*/
}
}
- @Deprecated
- @Override
- public <T> T resolveInstance(Class<T> expectedType, ObjectName objectName) {
- return resolveInstance(expectedType, objectName, new JmxAttribute(
- "unknown attribute"));
- }
-
@Override
public int compareTo(DependencyResolverImpl o) {
transactionStatus.checkCommitted();
.size());
}
- @Deprecated
- protected ObjectName createTestConfigBean(
- ConfigTransactionJMXClient transaction, String implementationName,
- String name, Class<?> clz) throws InstanceAlreadyExistsException {
- ObjectName nameCreated = transaction.createModule(implementationName,
- name);
- transaction.newMXBeanProxy(nameCreated, clz);
- return nameCreated;
- }
-
protected ObjectName createTestConfigBean(
ConfigTransactionJMXClient transaction, String implementationName,
String name) throws InstanceAlreadyExistsException {
import javax.management.ObjectName;
import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.JmxAttribute;
import org.opendaylight.controller.config.api.ModuleIdentifier;
import org.opendaylight.controller.config.api.annotations.RequireInterface;
import org.opendaylight.controller.config.manager.testingservices.seviceinterface.TestingThreadPoolServiceInterface;
return instance.getMaxNumberOfThreads();
}
+ // this would be generated:
+ private final JmxAttribute threadPoolONJMXAttribute = new JmxAttribute("threadPoolON");
+
@Override
public void validate() {
checkNotNull(threadPoolON, "Parameter 'threadPool' must be set");
dependencyResolver.validateDependency(
TestingThreadPoolServiceInterface.class, threadPoolON,
- "threadPoolON");
+ threadPoolONJMXAttribute);
checkState(Strings.isNullOrEmpty(someParam) == false,
"Parameter 'SomeParam' is blank");
// check that calling resolveInstance fails
try {
dependencyResolver.resolveInstance(TestingThreadPoolIfc.class,
- threadPoolON);
+ threadPoolON, threadPoolONJMXAttribute);
throw new RuntimeException("fail");
} catch (IllegalStateException e) {
checkState("Commit was not triggered".equals(e.getMessage()),
public Closeable getInstance() {
if (instance == null) {
TestingThreadPoolIfc threadPoolInstance = dependencyResolver
- .resolveInstance(TestingThreadPoolIfc.class, threadPoolON);
+ .resolveInstance(TestingThreadPoolIfc.class, threadPoolON, threadPoolONJMXAttribute);
if (oldInstance != null) {
// changing thread pool is not supported