+++ /dev/null
-/*
- * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.mdsal.binding.dom.adapter;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.mdsal.binding.api.ActionProviderService;
-import org.opendaylight.mdsal.binding.api.ActionService;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.MountPointService;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory;
-import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
-import org.opendaylight.mdsal.dom.api.DOMActionService;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMMountPointService;
-import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
-import org.opendaylight.mdsal.dom.api.DOMNotificationService;
-import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
-import org.opendaylight.mdsal.dom.api.DOMRpcService;
-
-abstract class AbstractAdapterFactory implements AdapterFactory {
- @Override
- public final DataBroker createDataBroker(final DOMDataBroker domService) {
- return new BindingDOMDataBrokerAdapter(context(), domService);
- }
-
- @Override
- public final MountPointService createMountPointService(final DOMMountPointService domService) {
- return new BindingDOMMountPointServiceAdapter(context(), domService);
- }
-
- @Override
- public final NotificationService createNotificationService(final DOMNotificationService domService) {
- return new BindingDOMNotificationServiceAdapter(context(), domService);
- }
-
- @Override
- public final NotificationPublishService createNotificationPublishService(
- final DOMNotificationPublishService domService) {
- return new BindingDOMNotificationPublishServiceAdapter(context(), domService);
- }
-
- @Override
- public final RpcConsumerRegistry createRpcConsumerRegistry(final DOMRpcService domService) {
- return new BindingDOMRpcServiceAdapter(context(), domService);
- }
-
- @Override
- public final RpcProviderService createRpcProviderService(final DOMRpcProviderService domService) {
- return new BindingDOMRpcProviderServiceAdapter(context(), domService);
- }
-
- @Override
- public final ActionService createActionService(final DOMActionService domService) {
- return new ActionServiceAdapter(context(), domService);
- }
-
- @Override
- public final ActionProviderService createActionProviderService(final DOMActionProviderService domService) {
- return new ActionProviderServiceAdapter(context(), domService);
- }
-
- abstract @NonNull AdapterContext context();
-}
import javax.inject.Singleton;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.kohsuke.MetaInfServices;
+import org.opendaylight.mdsal.binding.api.ActionProviderService;
+import org.opendaylight.mdsal.binding.api.ActionService;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.MountPointService;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory;
+import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
+import org.opendaylight.mdsal.dom.api.DOMActionService;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
import org.opendaylight.yangtools.concepts.Immutable;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
/**
* Implementation of AdapterFactory.
* @author Robert Varga
*/
@Beta
+@Component(immediate = true, service = AdapterFactory.class)
@MetaInfServices(value = AdapterFactory.class)
@NonNullByDefault
@Singleton
-public final class BindingAdapterFactory extends AbstractAdapterFactory implements Immutable {
+public final class BindingAdapterFactory implements AdapterFactory, Immutable {
private final AdapterContext codec;
public BindingAdapterFactory() {
}
@Inject
- public BindingAdapterFactory(final AdapterContext codec) {
+ @Activate
+ public BindingAdapterFactory(@Reference final AdapterContext codec) {
this.codec = requireNonNull(codec);
}
@Override
- AdapterContext context() {
- return codec;
+ public DataBroker createDataBroker(final DOMDataBroker domService) {
+ return new BindingDOMDataBrokerAdapter(codec, domService);
+ }
+
+ @Override
+ public MountPointService createMountPointService(final DOMMountPointService domService) {
+ return new BindingDOMMountPointServiceAdapter(codec, domService);
+ }
+
+ @Override
+ public NotificationService createNotificationService(final DOMNotificationService domService) {
+ return new BindingDOMNotificationServiceAdapter(codec, domService);
+ }
+
+ @Override
+ public NotificationPublishService createNotificationPublishService(
+ final DOMNotificationPublishService domService) {
+ return new BindingDOMNotificationPublishServiceAdapter(codec, domService);
+ }
+
+ @Override
+ public RpcConsumerRegistry createRpcConsumerRegistry(final DOMRpcService domService) {
+ return new BindingDOMRpcServiceAdapter(codec, domService);
+ }
+
+ @Override
+ public RpcProviderService createRpcProviderService(final DOMRpcProviderService domService) {
+ return new BindingDOMRpcProviderServiceAdapter(codec, domService);
+ }
+
+ @Override
+ public ActionService createActionService(final DOMActionService domService) {
+ return new ActionServiceAdapter(codec, domService);
+ }
+
+ @Override
+ public ActionProviderService createActionProviderService(final DOMActionProviderService domService) {
+ return new ActionProviderServiceAdapter(codec, domService);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.mdsal.binding.dom.adapter;
-
-import static com.google.common.base.Verify.verifyNotNull;
-
-import com.google.common.annotations.Beta;
-import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory;
-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;
-
-@Beta
-@Component(immediate = true, service = AdapterFactory.class)
-// TODO: once we have constructor injection, unify this with BindingAdapterFactory
-public final class OSGiBindingAdapterFactory extends AbstractAdapterFactory {
- private static final Logger LOG = LoggerFactory.getLogger(OSGiBindingAdapterFactory.class);
-
- @Reference
- AdapterContext codec = null;
-
- @Override
- AdapterContext context() {
- return verifyNotNull(codec);
- }
-
- @Activate
- @SuppressWarnings("static-method")
- void activate() {
- LOG.info("Binding Adapter Factory activated");
- }
-
- @Deactivate
- @SuppressWarnings("static-method")
- void deactivate() {
- LOG.info("Binding Adapter Factory deactivated");
- }
-}