|
15 | 15 | */ |
16 | 16 | package org.grails.plugins; |
17 | 17 |
|
18 | | -import groovy.util.XmlSlurper; |
19 | | -import groovy.util.slurpersupport.GPathResult; |
20 | | -import groovy.util.slurpersupport.Node; |
21 | | - |
22 | | -import java.io.IOException; |
23 | | -import java.io.InputStream; |
24 | | -import java.util.*; |
25 | | - |
26 | | -import javax.xml.parsers.ParserConfigurationException; |
27 | | -import javax.xml.parsers.SAXParser; |
28 | | - |
29 | | -import org.apache.commons.logging.Log; |
30 | | -import org.apache.commons.logging.LogFactory; |
31 | 18 | import grails.core.GrailsApplication; |
| 19 | +import grails.core.support.ParentApplicationContextAware; |
32 | 20 | import org.grails.core.exceptions.GrailsConfigurationException; |
33 | | -import org.grails.core.io.CachingPathMatchingResourcePatternResolver; |
34 | 21 | import org.grails.io.support.SpringIOUtils; |
35 | | -import grails.core.support.ParentApplicationContextAware; |
| 22 | +import org.slf4j.Logger; |
| 23 | +import org.slf4j.LoggerFactory; |
36 | 24 | import org.springframework.context.ApplicationContext; |
37 | 25 | import org.springframework.core.io.Resource; |
38 | | -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
39 | | -import org.springframework.util.StringUtils; |
| 26 | +import org.springframework.core.io.UrlResource; |
40 | 27 | import org.xml.sax.Attributes; |
41 | 28 | import org.xml.sax.SAXException; |
42 | 29 | import org.xml.sax.helpers.DefaultHandler; |
43 | 30 |
|
| 31 | +import javax.xml.parsers.ParserConfigurationException; |
| 32 | +import javax.xml.parsers.SAXParser; |
| 33 | +import java.io.IOException; |
| 34 | +import java.io.InputStream; |
| 35 | +import java.net.URL; |
| 36 | +import java.util.*; |
| 37 | + |
44 | 38 | /** |
45 | 39 | * Loads core plugin classes. Contains functionality moved in from <code>DefaultGrailsPluginManager</code>. |
46 | 40 | * |
|
49 | 43 | */ |
50 | 44 | public class CorePluginFinder implements ParentApplicationContextAware { |
51 | 45 |
|
52 | | - private static final Log LOG = LogFactory.getLog(CorePluginFinder.class); |
53 | | - public static final String CORE_PLUGIN_PATTERN = "classpath*:META-INF/grails-plugin.xml"; |
| 46 | + private static final Logger LOG = LoggerFactory.getLogger(CorePluginFinder.class); |
| 47 | + public static final String CORE_PLUGIN_PATTERN = "META-INF/grails-plugin.xml"; |
54 | 48 |
|
55 | | - private PathMatchingResourcePatternResolver resolver = CachingPathMatchingResourcePatternResolver.INSTANCE; |
56 | 49 | private final Set<Class<?>> foundPluginClasses = new HashSet<Class<?>>(); |
57 | 50 | @SuppressWarnings("unused") |
58 | 51 | private final GrailsApplication application; |
@@ -86,7 +79,13 @@ public BinaryGrailsPluginDescriptor getBinaryDescriptor(Class<?> pluginClass) { |
86 | 79 | } |
87 | 80 |
|
88 | 81 | private Resource[] resolvePluginResources() throws IOException { |
89 | | - return resolver.getResources(CORE_PLUGIN_PATTERN); |
| 82 | + Enumeration<URL> resources = application.getClassLoader().getResources(CORE_PLUGIN_PATTERN); |
| 83 | + List<Resource> resourceList = new ArrayList<>(); |
| 84 | + while (resources.hasMoreElements()) { |
| 85 | + URL url = resources.nextElement(); |
| 86 | + resourceList.add(new UrlResource(url)); |
| 87 | + } |
| 88 | + return resourceList.toArray(new Resource[resourceList.size()]); |
90 | 89 | } |
91 | 90 |
|
92 | 91 |
|
@@ -147,9 +146,6 @@ private void addPlugin(Class<?> plugin) { |
147 | 146 | } |
148 | 147 |
|
149 | 148 | public void setParentApplicationContext(ApplicationContext parent) { |
150 | | - if (parent != null) { |
151 | | - resolver = new PathMatchingResourcePatternResolver(parent); |
152 | | - } |
153 | 149 | } |
154 | 150 |
|
155 | 151 | private enum PluginParseState { |
|
0 commit comments