blob: 5886078bbbc85bbd283fd7aa88b25a0d56365781 [file] [log] [blame]
Thomas Vachuska4998caa2015-08-26 13:28:38 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuska4998caa2015-08-26 13:28:38 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.incubator.net.config.impl;
17
18import com.google.common.collect.ImmutableSet;
Ray Milkeyd84f89b2018-08-17 14:54:17 -070019import org.osgi.service.component.annotations.Activate;
20import org.osgi.service.component.annotations.Component;
21import org.osgi.service.component.annotations.Deactivate;
22import org.osgi.service.component.annotations.Reference;
23import org.osgi.service.component.annotations.ReferenceCardinality;
Thomas Vachuska4998caa2015-08-26 13:28:38 -070024import org.onosproject.net.config.ConfigFactory;
25import org.onosproject.net.config.NetworkConfigRegistry;
26import org.slf4j.Logger;
27import org.slf4j.LoggerFactory;
28
29import java.util.Set;
30
Thomas Vachuska4998caa2015-08-26 13:28:38 -070031/**
32 * Component for registration of builtin basic network configurations.
33 */
34@Component(immediate = true)
35public class ExtraNetworkConfigs {
36
37 private final Logger log = LoggerFactory.getLogger(getClass());
38
Brian O'Connorbd7f8782015-11-19 23:12:37 -080039 private final Set<ConfigFactory> factories = ImmutableSet.of();
Thomas Vachuska4998caa2015-08-26 13:28:38 -070040
Ray Milkeyd84f89b2018-08-17 14:54:17 -070041 @Reference(cardinality = ReferenceCardinality.MANDATORY)
Thomas Vachuska4998caa2015-08-26 13:28:38 -070042 protected NetworkConfigRegistry registry;
43
44 @Activate
45 public void activate() {
46 factories.forEach(registry::registerConfigFactory);
47 log.info("Started");
48 }
49
50 @Deactivate
51 public void deactivate() {
52 factories.forEach(registry::unregisterConfigFactory);
53 log.info("Stopped");
54 }
55
56}