private static void addExtensionToMap(Class extensionClass, Map<String, Class> siddhiExtensionsMap,
                                          ConcurrentHashMap<Class, AbstractExtensionHolder> extensionHolderMap,
                                          Map<String, Class> deprecatedSiddhiExtensionsMap) {
        Extension siddhiExtensionAnnotation = (Extension) extensionClass.getAnnotation(Extension.class);
        if (siddhiExtensionAnnotation != null) {
            if (!siddhiExtensionAnnotation.name().isEmpty()) {
                Class previousClass = null;
                if (!siddhiExtensionAnnotation.namespace().isEmpty()) {
                    String key = siddhiExtensionAnnotation.namespace() + SiddhiConstants.EXTENSION_SEPARATOR +
                            siddhiExtensionAnnotation.name();
                    Class existingValue = siddhiExtensionsMap.get(key);
                    if (existingValue == null) {
                        previousClass = siddhiExtensionsMap.put(key, extensionClass);
                        if (siddhiExtensionAnnotation.deprecated()) {
                            deprecatedSiddhiExtensionsMap.put(key, extensionClass);
                        }
                        for (Class clazz : extensionNameSpaceList) {
                            putToExtensionHolderMap(clazz, extensionClass, key,
                                    extensionHolderMap);
                        }
                    }
                    if (previousClass != null) {
                        log.warn("Dropping extension '" + previousClass + "' as '" + extensionClass + "' is " +
                                "loaded with the same namespace and name '" +
                                siddhiExtensionAnnotation.namespace() + SiddhiConstants.EXTENSION_SEPARATOR +
                                siddhiExtensionAnnotation.name() + "'");
                    }
                } else {
                    previousClass = siddhiExtensionsMap.put(siddhiExtensionAnnotation.name(), extensionClass);
                    if (siddhiExtensionAnnotation.deprecated()) {
                        deprecatedSiddhiExtensionsMap.put(siddhiExtensionAnnotation.name(), extensionClass);
                    }
                    if (previousClass != null) {
                        log.warn("Dropping extension '" + previousClass + "' as '" + extensionClass + "' is " +
                                "loaded with the same name '" + siddhiExtensionAnnotation.name() + "'");
                    }
                }
            } else {
                log.error("Unable to load extension " + extensionClass.getName() + ", missing Extension annotation.");
            }
        } else {
            log.error("Unable to load extension " + extensionClass.getName() + ", empty name element given in " +
                    "Extension annotation.");
        }
    }
Adding extensions to Siddhi siddhiExtensionsMap.

@param extensionClass                extension class
@param siddhiExtensionsMap           reference map for the Siddhi extension
@param extensionHolderMap            reference map for the Siddhi extension holder
@param deprecatedSiddhiExtensionsMap reference map for the deprecated Siddhi extensions
modules/siddhi-core/src/main/java/io/siddhi/core/util/SiddhiExtensionLoader.java