fix(系统设置): 去掉pf4j的spi服务发现机制
This commit is contained in:
parent
946bd807d3
commit
10fbb605f2
|
@ -70,15 +70,8 @@ public class JdbcDriverServiceProviderExtensionFinder extends ServiceProviderExt
|
|||
String pluginId = plugin.getDescriptor().getPluginId();
|
||||
LogUtils.debug("Reading extensions storages for plugin '{}'", pluginId);
|
||||
final Set<String> bucket = new HashSet<>();
|
||||
|
||||
try {
|
||||
Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(ServiceProviderExtensionStorage.EXTENSIONS_RESOURCE);
|
||||
if (urls.hasMoreElements()) {
|
||||
// 如果 ServiceProviderExtensionFinder 无法从 "META-INF/services" 加载,才加载
|
||||
return result;
|
||||
}
|
||||
|
||||
urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(EXTENSIONS_RESOURCE);
|
||||
Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(EXTENSIONS_RESOURCE);
|
||||
if (urls.hasMoreElements()) {
|
||||
jdbcCollectExtensions(urls, bucket);
|
||||
} else {
|
||||
|
|
|
@ -11,7 +11,6 @@ public class MsPluginManager extends DefaultPluginManager {
|
|||
@Override
|
||||
protected ExtensionFinder createExtensionFinder() {
|
||||
DefaultExtensionFinder extensionFinder = (DefaultExtensionFinder) super.createExtensionFinder();
|
||||
extensionFinder.addServiceProviderExtensionFinder();
|
||||
extensionFinder.add(new JdbcDriverServiceProviderExtensionFinder(this));
|
||||
return extensionFinder;
|
||||
}
|
||||
|
|
|
@ -21,10 +21,9 @@ import io.metersphere.system.mapper.TestResourcePoolMapper;
|
|||
import io.metersphere.system.mapper.TestResourcePoolOrganizationMapper;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -104,10 +103,9 @@ public class BaseResourcePoolTestService {
|
|||
|
||||
public void insertResourcePoolProject(TestResourcePool resourcePool) {
|
||||
ProjectTestResourcePoolExample example = new ProjectTestResourcePoolExample();
|
||||
example.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID);
|
||||
example.createCriteria().andTestResourcePoolIdEqualTo(resourcePool.getId());
|
||||
List<ProjectTestResourcePool> projectTestResourcePools = projectTestResourcePoolMapper.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(projectTestResourcePools)) {
|
||||
example.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID)
|
||||
.andTestResourcePoolIdEqualTo(resourcePool.getId());
|
||||
if (projectTestResourcePoolMapper.countByExample(example) == 0) {
|
||||
ProjectTestResourcePool projectTestResourcePool = new ProjectTestResourcePool();
|
||||
projectTestResourcePool.setTestResourcePoolId(resourcePool.getId());
|
||||
projectTestResourcePool.setProjectId(DEFAULT_PROJECT_ID);
|
||||
|
@ -117,10 +115,9 @@ public class BaseResourcePoolTestService {
|
|||
|
||||
public void insertResourcePoolOrg(TestResourcePool resourcePool) {
|
||||
TestResourcePoolOrganizationExample example = new TestResourcePoolOrganizationExample();
|
||||
example.createCriteria().andOrgIdEqualTo(DEFAULT_ORGANIZATION_ID);
|
||||
example.createCriteria().andTestResourcePoolIdEqualTo(resourcePool.getId());
|
||||
List<TestResourcePoolOrganization> testResourcePoolOrganizations = testResourcePoolOrganizationMapper.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(testResourcePoolOrganizations)) {
|
||||
example.createCriteria().andOrgIdEqualTo(DEFAULT_ORGANIZATION_ID)
|
||||
.andTestResourcePoolIdEqualTo(resourcePool.getId());
|
||||
if (testResourcePoolOrganizationMapper.countByExample(example) == 0) {
|
||||
TestResourcePoolOrganization resourcePoolOrganization = new TestResourcePoolOrganization();
|
||||
resourcePoolOrganization.setTestResourcePoolId(resourcePool.getId());
|
||||
resourcePoolOrganization.setOrgId(DEFAULT_ORGANIZATION_ID);
|
||||
|
|
|
@ -90,7 +90,7 @@ public class PluginLoadService {
|
|||
if (!file.exists()) {
|
||||
try (InputStream fileAsStream = FileCenter.getDefaultRepository().getFileAsStream(getDefaultRepositoryFileRequest(fileName))) {
|
||||
FileUtils.copyInputStreamToFile(fileAsStream, file);
|
||||
loadPlugin(filePath);
|
||||
loadPlugin(fileName);
|
||||
} catch (Exception e) {
|
||||
LogUtils.error("从对象存储加载插件异常", e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue