We do not need a Hashtable, use FrameworkUtil to give us what we need.
Change-Id: I50099a7b8f036d7f7f8af467242005e74b48d89d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashSet;
-import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
import org.apache.aries.blueprint.NamespaceHandler;
import org.apache.aries.blueprint.services.BlueprintExtenderService;
import org.apache.aries.quiesce.participant.QuiesceParticipant;
import org.apache.aries.util.AriesFrameworkUtil;
import org.eclipse.jdt.annotation.Nullable;
-import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.opendaylight.controller.blueprint.ext.OpendaylightNamespaceHandler;
import org.opendaylight.yangtools.util.xml.UntrustedXML;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.SynchronousBundleListener;
}
private void registerNamespaceHandler(final BundleContext context) {
- Dictionary<String, Object> props = emptyDict();
- props.put("osgi.service.blueprint.namespace", OpendaylightNamespaceHandler.NAMESPACE_1_0_0);
- namespaceReg = context.registerService(NamespaceHandler.class, new OpendaylightNamespaceHandler(), props);
+ namespaceReg = context.registerService(NamespaceHandler.class, new OpendaylightNamespaceHandler(),
+ FrameworkUtil.asDictionary(Map.of(
+ "osgi.service.blueprint.namespace", OpendaylightNamespaceHandler.NAMESPACE_1_0_0)));
}
private void registerBlueprintEventHandler(final BundleContext context) {
eventHandlerReg = context.registerService(BlueprintListener.class, this, null);
}
- @SuppressModernizer
- private static Dictionary<String, Object> emptyDict() {
- return new Hashtable<>();
- }
-
/**
* Implemented from BundleActivator.
*/
import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.Dictionary;
-import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.aries.blueprint.ComponentDefinitionRegistry;
import org.opendaylight.controller.blueprint.BlueprintContainerRestartService;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.blueprint.reflect.BeanProperty;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
}
public void setBlueprintContainerRestartService(final BlueprintContainerRestartService restartService) {
- this.blueprintContainerRestartService = restartService;
+ blueprintContainerRestartService = restartService;
}
public void setRestartDependentsOnUpdates(final boolean restartDependentsOnUpdates) {
}
};
- Dictionary<String, Object> props = new Hashtable<>();
- props.put(Constants.SERVICE_PID, persistentId);
- props.put(Constants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
- props.put(Constants.BUNDLE_VERSION, bundle.getHeaders().get(Constants.BUNDLE_VERSION));
- managedServiceRegs.add(bundle.getBundleContext().registerService(ManagedService.class, managedService, props));
+ managedServiceRegs.add(bundle.getBundleContext().registerService(ManagedService.class, managedService,
+ FrameworkUtil.asDictionary(Map.of(
+ Constants.SERVICE_PID, persistentId,
+ Constants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName(),
+ Constants.BUNDLE_VERSION, bundle.getHeaders().get(Constants.BUNDLE_VERSION)))));
}
private String logName() {
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
-import java.util.Dictionary;
-import java.util.Hashtable;
import java.util.Map;
import org.checkerframework.checker.lock.qual.GuardedBy;
-import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.opendaylight.controller.cluster.ActorSystemProvider;
import org.opendaylight.controller.cluster.datastore.config.Configuration;
import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfigProvider;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.service.component.ComponentFactory;
import org.osgi.service.component.ComponentInstance;
import org.osgi.service.component.annotations.Activate;
}
@Override
- @SuppressModernizer
public void onSuccess(final Object result) {
LOG.debug("Distributed Datastore type {} reached initial settle", datastoreType);
synchronized (this) {
if (!stopped) {
- final Dictionary<String, Object> dict = new Hashtable<>();
- dict.put(OSGiDOMStore.DATASTORE_TYPE_PROP, datastoreType);
- dict.put(OSGiDOMStore.DATASTORE_INST_PROP, datastore);
- dict.put("type", serviceType);
- component = datastoreFactory.newInstance(dict);
+ component = datastoreFactory.newInstance(FrameworkUtil.asDictionary(Map.of(
+ OSGiDOMStore.DATASTORE_TYPE_PROP, datastoreType,
+ OSGiDOMStore.DATASTORE_INST_PROP, datastore,
+ "type", serviceType)));
LOG.info("Distributed Datastore type {} started", datastoreType);
}
}