org.apache.tamaya.osgi.injection.TamayaOSGIInjector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tamaya-osgi-injection Show documentation
Show all versions of tamaya-osgi-injection Show documentation
Tamaya OSGI Configuration Injector
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tamaya.osgi.injection;
import org.apache.tamaya.osgi.TamayaConfigPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.util.tracker.ServiceTracker;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
import java.util.logging.Logger;
/**
* Class that monitors services and configures them if they have {@code Tamaya-Config = true} in the
* service settings.
*/
public class TamayaOSGIInjector{
/** The logger. */
private static final Logger LOG = Logger.getLogger(TamayaConfigPlugin.class.getName());
/** The bundle context. */
private BundleContext context;
/** OSGI Config manager. */
private ConfigurationAdmin cm;
/** The service tracker. */
private ServiceTracker