Bump versions to 13.0.4-SNAPSHOT
[mdsal.git] / dom / mdsal-dom-schema-osgi / src / main / java / org / opendaylight / mdsal / dom / schema / osgi / impl / YangModuleInfoRegistry.java
1 /*
2  * Copyright (c) 2017, 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.dom.schema.osgi.impl;
9
10 import java.util.List;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.concepts.Registration;
13 import org.opendaylight.yangtools.yang.binding.YangFeatureProvider;
14 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
15 import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
16 import org.osgi.framework.BundleContext;
17 import org.osgi.service.component.ComponentFactory;
18
19 /**
20  * Update EffectiveModelContext service in Service Registry each time new YangModuleInfo is added or removed.
21  */
22 abstract class YangModuleInfoRegistry {
23     static @NonNull YangModuleInfoRegistry create(final BundleContext ctx,
24             final ComponentFactory<OSGiModuleInfoSnapshotImpl> contextFactory, final YangParserFactory factory) {
25         return KarafFeaturesSupport.wrap(ctx, new RegularYangModuleInfoRegistry(contextFactory, factory));
26     }
27
28     // Invocation from scanner, we may want to ignore this in order to not process partial updates
29     abstract void scannerUpdate();
30
31     abstract void scannerShutdown();
32
33     abstract void enableScannerAndUpdate();
34
35     abstract void close();
36
37     abstract @NonNull Registration registerBundle(List<YangModuleInfo> moduleInfos,
38         List<YangFeatureProvider<?>> featureProviders);
39 }