use of com.alipay.sofa.ark.spi.model.Biz in project sofa-ark by alipay.
the class ClassLoaderServiceImpl method isDeniedImportClass.
@Override
public boolean isDeniedImportClass(String bizIdentity, String className) {
Biz biz = bizManagerService.getBizByIdentity(bizIdentity);
if (biz == null) {
return false;
}
for (String pattern : biz.getDenyImportClasses()) {
if (pattern.equals(className)) {
return true;
}
}
String pkg = ClassUtils.getPackageName(className);
for (String pattern : biz.getDenyImportPackageNodes()) {
if (pkg.equals(pattern)) {
return true;
}
}
for (String pattern : biz.getDenyImportPackageStems()) {
if (pkg.startsWith(pattern)) {
return true;
}
}
return false;
}
use of com.alipay.sofa.ark.spi.model.Biz in project sofa-ark by alipay.
the class HandleArchiveStage method processEmbed.
protected void processEmbed(PipelineContext pipelineContext) throws Exception {
ClassLoader masterBizClassLoader = pipelineContext.getClass().getClassLoader();
Biz masterBiz = bizFactoryService.createEmbedMasterBiz(masterBizClassLoader);
bizManagerService.registerBiz(masterBiz);
ArkClient.setMasterBiz(masterBiz);
ArkConfigs.putStringValue(Constants.MASTER_BIZ, masterBiz.getBizName());
ExecutableArchive executableArchive = pipelineContext.getExecutableArchive();
List<PluginArchive> pluginArchives = executableArchive.getPluginArchives();
for (PluginArchive pluginArchive : pluginArchives) {
Plugin plugin = pluginFactoryService.createEmbedPlugin(pluginArchive, masterBizClassLoader);
if (!isPluginExcluded(plugin)) {
pluginManagerService.registerPlugin(plugin);
} else {
LOGGER.warn(String.format("The plugin of %s is excluded.", plugin.getPluginName()));
}
}
return;
}
use of com.alipay.sofa.ark.spi.model.Biz in project sofa-ark by alipay.
the class ArkTomcatServletWebServerFactory method getContextPath.
@Override
public String getContextPath() {
String contextPath = super.getContextPath();
if (bizManagerService == null) {
return contextPath;
}
Biz biz = bizManagerService.getBizByClassLoader(Thread.currentThread().getContextClassLoader());
if (!StringUtils.isEmpty(contextPath)) {
return contextPath;
} else if (biz != null) {
if (StringUtils.isEmpty(biz.getWebContextPath())) {
return ROOT_WEB_CONTEXT_PATH;
}
return biz.getWebContextPath();
} else {
return ROOT_WEB_CONTEXT_PATH;
}
}
Aggregations