+/*
+ * 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
+ */
+
/**
* Generated file
*/
package org.opendaylight.controller.config.yang.config.toaster_provider.impl;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sample.toaster.provider.OpendaylightToaster;
-import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Override
public java.lang.AutoCloseable createInstance() {
- final OpendaylightToaster opendaylightToaster = new OpendaylightToaster();
-
- // Register to md-sal
- opendaylightToaster.setNotificationProvider(getNotificationServiceDependency());
-
- DataBroker dataBrokerService = getDataBrokerDependency();
- opendaylightToaster.setDataProvider(dataBrokerService);
-
- final ListenerRegistration<DataChangeListener> dataChangeListenerRegistration = dataBrokerService
- .registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, OpendaylightToaster.TOASTER_IID,
- opendaylightToaster, DataChangeScope.SUBTREE);
-
- final BindingAwareBroker.RpcRegistration<ToasterService> rpcRegistration = getRpcRegistryDependency()
- .addRpcImplementation(ToasterService.class, opendaylightToaster);
-
- // Register runtimeBean for toaster statistics via JMX
- final ToasterProviderRuntimeRegistration runtimeReg = getRootRuntimeBeanRegistratorWrapper().register(
- opendaylightToaster);
-
- // Wrap toaster as AutoCloseable and close registrations to md-sal at
- // close()
- final class AutoCloseableToaster implements AutoCloseable {
-
- @Override
- public void close() throws Exception {
- dataChangeListenerRegistration.close();
- rpcRegistration.close();
- runtimeReg.close();
- opendaylightToaster.close();
- log.info("Toaster provider (instance {}) torn down.", this);
- }
- }
-
- AutoCloseable ret = new AutoCloseableToaster();
- log.info("Toaster provider (instance {}) initialized.", ret);
- return ret;
+ // The components are created and wired via blueprint and, since this module doesn't advertise any
+ // services, return an empty AutoCloseable. The config module is kept for backwards compatibility.
+ return NoopAutoCloseable.INSTANCE;
}
}