chore: 加载插件移动到sdk
This commit is contained in:
parent
3c136048fe
commit
833a9b7d26
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.system.plugin;
|
||||
package io.metersphere.sdk.plugin;
|
||||
|
||||
import org.pf4j.DefaultPluginDescriptor;
|
||||
import org.pf4j.PluginDescriptor;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.system.plugin;
|
||||
package io.metersphere.sdk.plugin;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.pf4j.ManifestPluginDescriptorFinder;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.system.plugin;
|
||||
package io.metersphere.sdk.plugin;
|
||||
|
||||
|
||||
import io.metersphere.sdk.util.LogUtils;
|
||||
|
@ -45,7 +45,7 @@ public class JdbcDriverServiceProviderExtensionFinder extends ServiceProviderExt
|
|||
try {
|
||||
Enumeration<URL> urls = getClass().getClassLoader().getResources(EXTENSIONS_RESOURCE);
|
||||
if (urls.hasMoreElements()) {
|
||||
collectExtensions(urls, bucket);
|
||||
jdbcCollectExtensions(urls, bucket);
|
||||
} else {
|
||||
LogUtils.debug("Cannot find '{}'", EXTENSIONS_RESOURCE);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class JdbcDriverServiceProviderExtensionFinder extends ServiceProviderExt
|
|||
|
||||
urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(EXTENSIONS_RESOURCE);
|
||||
if (urls.hasMoreElements()) {
|
||||
collectExtensions(urls, bucket);
|
||||
jdbcCollectExtensions(urls, bucket);
|
||||
} else {
|
||||
LogUtils.debug("Cannot find '{}'", EXTENSIONS_RESOURCE);
|
||||
}
|
||||
|
@ -96,15 +96,15 @@ public class JdbcDriverServiceProviderExtensionFinder extends ServiceProviderExt
|
|||
return result;
|
||||
}
|
||||
|
||||
private void collectExtensions(Enumeration<URL> urls, Set<String> bucket) throws URISyntaxException, IOException {
|
||||
private void jdbcCollectExtensions(Enumeration<URL> urls, Set<String> bucket) throws URISyntaxException, IOException {
|
||||
while (urls.hasMoreElements()) {
|
||||
URL url = urls.nextElement();
|
||||
LogUtils.debug("Read '{}'", url.getFile());
|
||||
collectExtensions(url, bucket);
|
||||
jdbcCollectExtensions(url, bucket);
|
||||
}
|
||||
}
|
||||
|
||||
private void collectExtensions(URL url, Set<String> bucket) throws URISyntaxException, IOException {
|
||||
private void jdbcCollectExtensions(URL url, Set<String> bucket) throws URISyntaxException, IOException {
|
||||
Path extensionPath;
|
||||
|
||||
if (url.toURI().getScheme().equals("jar")) {
|
||||
|
@ -114,13 +114,13 @@ public class JdbcDriverServiceProviderExtensionFinder extends ServiceProviderExt
|
|||
}
|
||||
|
||||
try {
|
||||
bucket.addAll(readExtensions(extensionPath));
|
||||
bucket.addAll(jdbcReadExtensions(extensionPath));
|
||||
} finally {
|
||||
FileUtils.closePath(extensionPath);
|
||||
}
|
||||
}
|
||||
|
||||
private Set<String> readExtensions(Path extensionPath) throws IOException {
|
||||
private Set<String> jdbcReadExtensions(Path extensionPath) throws IOException {
|
||||
final Set<String> result = new HashSet<>();
|
||||
Files.walkFileTree(extensionPath, Collections.<FileVisitOption>emptySet(), 1, new SimpleFileVisitor<Path>() {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.system.plugin;
|
||||
package io.metersphere.sdk.plugin;
|
||||
|
||||
import org.pf4j.*;
|
||||
|
|
@ -3,7 +3,6 @@ package io.metersphere.functional.dto;
|
|||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
@ -12,7 +11,6 @@ import java.util.Objects;
|
|||
* @author wx
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CaseCustomFieldDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -8,7 +8,7 @@ import io.metersphere.system.controller.handler.result.CommonResultCode;
|
|||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.system.file.FileCenter;
|
||||
import io.metersphere.system.file.FileRequest;
|
||||
import io.metersphere.system.plugin.MsPluginManager;
|
||||
import io.metersphere.sdk.plugin.MsPluginManager;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.LogUtils;
|
||||
import io.metersphere.sdk.util.MsFileUtils;
|
||||
|
|
Loading…
Reference in New Issue