Skip to content

Commit

Permalink
默认biz可见全部plugins,sofa.ark.biz.specify.dependent.plugins.enable=true时,…
Browse files Browse the repository at this point in the history
…指定可见范围
  • Loading branch information
yuanyuan2021 committed Sep 24, 2024
1 parent 4b08ce4 commit e4cd09b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@
import com.alipay.sofa.ark.spi.service.plugin.PluginManagerService;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.codehaus.plexus.util.CollectionUtils;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;

import java.util.ArrayList;
Expand Down Expand Up @@ -216,13 +214,15 @@ private URL[] getMergedBizClassPath(URL[] bizArchiveUrls, URL[] extensionUrls) {

private void resolveExportMapIfNecessary(BizModel bizModel, List<String> dependentPlugins) {
Set<Plugin> plugins = new HashSet<>();
if (ArkConfigs.areAllPluginsVisibleForBiz()) {
plugins.addAll(pluginManagerService.getPluginsInOrder());
} else if (dependentPlugins != null && !dependentPlugins.isEmpty()) {
for (String pluginName : dependentPlugins) {
Plugin plugin = pluginManagerService.getPluginByName(pluginName);
plugins.add(plugin);
if (ArkConfigs.isBizSpecifyDependentPluginsEnable()) {
if (dependentPlugins != null && !dependentPlugins.isEmpty()) {
for (String pluginName : dependentPlugins) {
Plugin plugin = pluginManagerService.getPluginByName(pluginName);
plugins.add(plugin);
}
}
} else {
plugins.addAll(pluginManagerService.getPluginsInOrder());
}

bizModel.setDependentPlugins(plugins);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public void test() throws Throwable {
Plugin plugin = pluginFactoryService.createPlugin(FileUtils.file(samplePlugin.getFile()));
pluginManagerService.registerPlugin(plugin);

System.setProperty(ALL_PLUGINS_VISIBLE_FOR_BIZ, Boolean.TRUE.toString());
URL sampleBiz = cl.getResource("sample-biz.jar");
Biz biz = bizFactoryService.createBiz(FileUtils.file(sampleBiz.getFile()));
bizManagerService.registerBiz(biz);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static void setEmbedStaticBizEnable(boolean enable) {
System.setProperty(Constants.EMBED_STATIC_BIZ_ENABLE, enable ? "true" : "false");
}

public static boolean areAllPluginsVisibleForBiz() {
return Boolean.getBoolean(Constants.ALL_PLUGINS_VISIBLE_FOR_BIZ);
public static boolean isBizSpecifyDependentPluginsEnable() {
return Boolean.getBoolean(Constants.BIZ_SPECIFY_DEPENDENT_PLUGINS_ENABLE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public class Constants {
public final static String EMBED_STATIC_BIZ_IN_RESOURCE_ENABLE = "sofa.ark.embed.static.biz.in.resource.enable";
public final static String ACTIVATE_NEW_MODULE = "activate.new.module";
public final static String PLUGIN_CLASS_ISOLATION_ENABLE = "sofa.ark.plugin.class.isolation.enable";
public final static String ALL_PLUGINS_VISIBLE_FOR_BIZ = "sofa.ark.all.plugins.visible.for.biz";
public final static String BIZ_SPECIFY_DEPENDENT_PLUGINS_ENABLE = "sofa.ark.biz.specify.dependent.plugins.enable";

public final static String AUTO_UNINSTALL_WHEN_FAILED_ENABLE = "sofa.ark.auto.uninstall.when.failed.enable";

Expand Down

0 comments on commit e4cd09b

Please sign in to comment.