package cd.casic.plugin;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class PluginDescriptorCache {
    private static final Map<String, PluginDescriptorStorage> pluginMaps = Collections.synchronizedMap(new HashMap<>());
    public static void put(String pluginId, PluginDescriptorStorage pluginDescriptorStorage) {
        pluginMaps.putIfAbsent(pluginId, pluginDescriptorStorage);
    }

    public static PluginDescriptorStorage getPlugin(String pluginId) {
        return pluginMaps.get(pluginId);
    }

    public static void remove(String pluginId) {
        pluginMaps.remove(pluginId);
    }

    public static Map<String, PluginDescriptorStorage> getAllPlugin() {
        return pluginMaps;
    }
}

