|
|
@ -15,9 +15,9 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package org.pf4j; |
|
|
|
package org.pf4j; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.pf4j.processor.LegacyExtensionStorage; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.pf4j.processor.LegacyExtensionStorage; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.io.InputStreamReader; |
|
|
@ -53,13 +53,7 @@ public class LegacyExtensionFinder extends AbstractExtensionFinder { |
|
|
|
Set<String> bucket = new HashSet<>(); |
|
|
|
Set<String> bucket = new HashSet<>(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
Enumeration<URL> urls = getClass().getClassLoader().getResources(getExtensionsResource()); |
|
|
|
Enumeration<URL> urls = getClass().getClassLoader().getResources(getExtensionsResource()); |
|
|
|
while (urls.hasMoreElements()) { |
|
|
|
collectExtensions(urls, bucket); |
|
|
|
URL url = urls.nextElement(); |
|
|
|
|
|
|
|
log.debug("Read '{}'", url.getFile()); |
|
|
|
|
|
|
|
try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { |
|
|
|
|
|
|
|
LegacyExtensionStorage.read(reader, bucket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
debugExtensions(bucket); |
|
|
|
debugExtensions(bucket); |
|
|
|
|
|
|
|
|
|
|
@ -84,16 +78,10 @@ public class LegacyExtensionFinder extends AbstractExtensionFinder { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource()); |
|
|
|
Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource()); |
|
|
|
if (urls == null || !urls.hasMoreElements()) { |
|
|
|
if (urls.hasMoreElements()) { |
|
|
|
log.debug("Cannot find '{}'", getExtensionsResource()); |
|
|
|
collectExtensions(urls, bucket); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
while (urls.hasMoreElements()) { |
|
|
|
log.debug("Cannot find '{}'", getExtensionsResource()); |
|
|
|
URL url = urls.nextElement(); |
|
|
|
|
|
|
|
log.debug("Read '{}'", url.getFile()); |
|
|
|
|
|
|
|
try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { |
|
|
|
|
|
|
|
LegacyExtensionStorage.read(reader, bucket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
debugExtensions(bucket); |
|
|
|
debugExtensions(bucket); |
|
|
@ -107,6 +95,16 @@ public class LegacyExtensionFinder extends AbstractExtensionFinder { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void collectExtensions(Enumeration<URL> urls, Set<String> bucket) throws IOException { |
|
|
|
|
|
|
|
while (urls.hasMoreElements()) { |
|
|
|
|
|
|
|
URL url = urls.nextElement(); |
|
|
|
|
|
|
|
log.debug("Read '{}'", url.getFile()); |
|
|
|
|
|
|
|
try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { |
|
|
|
|
|
|
|
LegacyExtensionStorage.read(reader, bucket); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static String getExtensionsResource() { |
|
|
|
private static String getExtensionsResource() { |
|
|
|
return LegacyExtensionStorage.EXTENSIONS_RESOURCE; |
|
|
|
return LegacyExtensionStorage.EXTENSIONS_RESOURCE; |
|
|
|
} |
|
|
|
} |
|
|
|