import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.parser.api.YangParserException;
import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
@Beta
+@Component
@Singleton
public final class DefaultBaseNetconfSchemas implements BaseNetconfSchemas {
private final @NonNull BaseSchema withoutNotifications;
private final @NonNull BaseSchema withNotifications;
@Inject
- public DefaultBaseNetconfSchemas(final YangParserFactory parserFactory) throws YangParserException {
+ @Activate
+ public DefaultBaseNetconfSchemas(@Reference final YangParserFactory parserFactory) throws YangParserException {
withoutNotifications = new BaseSchema(withoutNotifications(parserFactory));
withNotifications = new BaseSchema(withNotifications(parserFactory));
}
@Override
- public @NonNull BaseSchema getBaseSchema() {
+ public BaseSchema getBaseSchema() {
return withoutNotifications;
}
@Override
- public @NonNull BaseSchema getBaseSchemaWithNotifications() {
+ public BaseSchema getBaseSchemaWithNotifications() {
return withNotifications;
}
+++ /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.netconf.sal.connect.netconf.schema.mapping;
-
-import com.google.common.annotations.Beta;
-import org.opendaylight.yangtools.yang.parser.api.YangParserException;
-import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
-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)
-public final class OSGiBaseNetconfSchemas implements BaseNetconfSchemas {
- private static final Logger LOG = LoggerFactory.getLogger(OSGiBaseNetconfSchemas.class);
-
- @Reference
- YangParserFactory parserFactory;
-
- private DefaultBaseNetconfSchemas delegate;
-
- @Override
- public BaseSchema getBaseSchema() {
- return delegate.getBaseSchema();
- }
-
- @Override
- public BaseSchema getBaseSchemaWithNotifications() {
- return delegate.getBaseSchemaWithNotifications();
- }
-
- @Activate
- void activate() throws YangParserException {
- delegate = new DefaultBaseNetconfSchemas(parserFactory);
- LOG.info("Base NETCONF Schemas started");
- }
-
- @Deactivate
- void deactivate() {
- delegate = null;
- LOG.info("Base NETCONF Schemas stopped");
- }
-}