Search in sources :

Example 41 with Plugin

use of com.alipay.sofa.ark.spi.model.Plugin in project sofa-ark by sofastack.

the class PluginManagerServiceImpl method getPluginsInOrder.

@Override
public List<Plugin> getPluginsInOrder() {
    List<Plugin> pluginList = new ArrayList<>(plugins.values());
    Collections.sort(pluginList, new OrderComparator());
    return pluginList;
}
Also used : ArrayList(java.util.ArrayList) OrderComparator(com.alipay.sofa.ark.common.util.OrderComparator) Plugin(com.alipay.sofa.ark.spi.model.Plugin)

Example 42 with Plugin

use of com.alipay.sofa.ark.spi.model.Plugin in project sofa-ark by sofastack.

the class ClassLoaderServiceImpl method prepareExportClassAndResourceCache.

@Override
public void prepareExportClassAndResourceCache() {
    for (Plugin plugin : pluginManagerService.getPluginsInOrder()) {
        for (String exportIndex : plugin.getExportPackageNodes()) {
            exportNodeAndClassLoaderMap.putIfAbsent(exportIndex, plugin.getPluginClassLoader());
        }
        for (String exportIndex : plugin.getExportPackageStems()) {
            exportStemAndClassLoaderMap.putIfAbsent(exportIndex, plugin.getPluginClassLoader());
        }
        for (String exportIndex : plugin.getExportClasses()) {
            exportClassAndClassLoaderMap.putIfAbsent(exportIndex, plugin.getPluginClassLoader());
        }
        for (String resource : plugin.getExportResources()) {
            exportResourceAndClassLoaderMap.putIfAbsent(resource, new LinkedList<>());
            exportResourceAndClassLoaderMap.get(resource).add(plugin.getPluginClassLoader());
        }
        for (String resource : plugin.getExportPrefixResourceStems()) {
            exportPrefixStemResourceAndClassLoaderMap.putIfAbsent(resource, new LinkedList<>());
            exportPrefixStemResourceAndClassLoaderMap.get(resource).add(plugin.getPluginClassLoader());
        }
        for (String resource : plugin.getExportSuffixResourceStems()) {
            exportSuffixStemResourceAndClassLoaderMap.putIfAbsent(resource, new LinkedList<>());
            exportSuffixStemResourceAndClassLoaderMap.get(resource).add(plugin.getPluginClassLoader());
        }
    }
}
Also used : Plugin(com.alipay.sofa.ark.spi.model.Plugin)

Aggregations

Plugin (com.alipay.sofa.ark.spi.model.Plugin)42 Test (org.junit.Test)22 BaseTest (com.alipay.sofa.ark.container.BaseTest)20 PluginModel (com.alipay.sofa.ark.container.model.PluginModel)14 URL (java.net.URL)14 Biz (com.alipay.sofa.ark.spi.model.Biz)10 File (java.io.File)10 JarFile (com.alipay.sofa.ark.loader.jar.JarFile)6 PluginArchive (com.alipay.sofa.ark.spi.archive.PluginArchive)6 HashSet (java.util.HashSet)6 BizModel (com.alipay.sofa.ark.container.model.BizModel)4 ArkRuntimeException (com.alipay.sofa.ark.exception.ArkRuntimeException)4 JarPluginArchive (com.alipay.sofa.ark.loader.JarPluginArchive)4 JarFileArchive (com.alipay.sofa.ark.loader.archive.JarFileArchive)4 ExecutableArchive (com.alipay.sofa.ark.spi.archive.ExecutableArchive)4 AfterBizStartupEvent (com.alipay.sofa.ark.spi.event.biz.AfterBizStartupEvent)4 BeforePluginStartupEvent (com.alipay.sofa.ark.spi.event.plugin.BeforePluginStartupEvent)4 OrderComparator (com.alipay.sofa.ark.common.util.OrderComparator)2 DirectoryBizArchive (com.alipay.sofa.ark.loader.DirectoryBizArchive)2 JarBizArchive (com.alipay.sofa.ark.loader.JarBizArchive)2