2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.parser.impl;
10 import com.google.common.annotations.Beta;
11 import java.util.Collection;
12 import org.opendaylight.yangtools.yang.model.parser.api.YangParser;
13 import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
14 import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
15 import org.opendaylight.yangtools.yang.xpath.api.YangXPathParserFactory;
16 import org.osgi.service.component.annotations.Activate;
17 import org.osgi.service.component.annotations.Component;
18 import org.osgi.service.component.annotations.Deactivate;
19 import org.osgi.service.component.annotations.Reference;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
24 @Component(immediate = true)
25 // FIXME: merge this with YangParserFactoryImpl once we have OSGi R7, which we really want because field injection is
26 // a static analysis pain. It also results in not-obvious classes like this one.
27 public final class OSGiYangParserFactory implements YangParserFactory {
28 private static final Logger LOG = LoggerFactory.getLogger(OSGiYangParserFactory.class);
31 YangXPathParserFactory xpathFactory = null;
33 private YangParserFactory delegate = null;
37 delegate = new YangParserFactoryImpl(xpathFactory);
38 LOG.info("YANG Parser activated");
43 LOG.info("YANG Parser deactivated");
48 public Collection<StatementParserMode> supportedParserModes() {
49 return delegate.supportedParserModes();
53 public YangParser createParser(final StatementParserMode parserMode) {
54 return delegate.createParser(parserMode);