package org.opendaylight.transportpce.olm;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.transportpce.olm.service.OlmPowerService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.TransportpceOlmService;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class OlmProvider.
*/
+@Component
public class OlmProvider {
private static final Logger LOG = LoggerFactory.getLogger(OlmProvider.class);
- private final RpcProviderService rpcProviderService;
- private final OlmPowerService olmPowerService;
private ObjectRegistration<TransportpceOlmService> olmRPCRegistration;
/**
* Instantiates a new olm provider.
- * @param olmPowerService
- * implementation of OlmService
+ * @param olmPowerServiceRpc
+ * implementation of TransportpceOlmService
* @param rpcProviderService
* the rpc provider service
*/
- public OlmProvider(final RpcProviderService rpcProviderService, final OlmPowerService olmPowerService) {
- this.rpcProviderService = rpcProviderService;
- this.olmPowerService = olmPowerService;
- }
-
- /**
- * Method called when the blueprint container is created.
- */
- public void init() {
- LOG.info("OlmProvider Session Initiated");
- // Initializing Notification module
+ @Activate
+ public OlmProvider(@Reference final RpcProviderService rpcProviderService,
+ @Reference final TransportpceOlmService olmPowerServiceRpc) {
olmRPCRegistration = rpcProviderService.registerRpcImplementation(TransportpceOlmService.class,
- new OlmPowerServiceRpcImpl(this.olmPowerService));
+ olmPowerServiceRpc);
+ LOG.info("OlmProvider Session Initiated");
}
/**
* Method called when the blueprint container is destroyed.
*/
+ @Deactivate
public void close() {
LOG.info("OlmProvider Closed");
// Clean up the RPC service registration