|
|
|
@ -17,6 +17,7 @@ |
|
|
|
package org.springframework.beans.factory.xml; |
|
|
|
package org.springframework.beans.factory.xml; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.FileNotFoundException; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
@ -99,23 +100,30 @@ public class PluggableSchemaResolver implements EntityResolver { |
|
|
|
this.schemaMappingsLocation = schemaMappingsLocation; |
|
|
|
this.schemaMappingsLocation = schemaMappingsLocation; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public InputSource resolveEntity(String publicId, String systemId) throws IOException { |
|
|
|
public InputSource resolveEntity(String publicId, String systemId) throws IOException { |
|
|
|
if (logger.isTraceEnabled()) { |
|
|
|
if (logger.isTraceEnabled()) { |
|
|
|
logger.trace("Trying to resolve XML entity with public id [" + publicId + |
|
|
|
logger.trace("Trying to resolve XML entity with public id [" + publicId + |
|
|
|
"] and system id [" + systemId + "]"); |
|
|
|
"] and system id [" + systemId + "]"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (systemId != null) { |
|
|
|
if (systemId != null) { |
|
|
|
String resourceLocation = getSchemaMappings().get(systemId); |
|
|
|
String resourceLocation = getSchemaMappings().get(systemId); |
|
|
|
if (resourceLocation != null) { |
|
|
|
if (resourceLocation != null) { |
|
|
|
Resource resource = new ClassPathResource(resourceLocation, this.classLoader); |
|
|
|
Resource resource = new ClassPathResource(resourceLocation, this.classLoader); |
|
|
|
InputSource source = new InputSource(resource.getInputStream()); |
|
|
|
try { |
|
|
|
source.setPublicId(publicId); |
|
|
|
InputSource source = new InputSource(resource.getInputStream()); |
|
|
|
source.setSystemId(systemId); |
|
|
|
source.setPublicId(publicId); |
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
source.setSystemId(systemId); |
|
|
|
logger.debug("Found XML schema [" + systemId + "] in classpath: " + resourceLocation); |
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
|
|
|
logger.debug("Found XML schema [" + systemId + "] in classpath: " + resourceLocation); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return source; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (FileNotFoundException ex) { |
|
|
|
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
|
|
|
logger.debug("Couldn't find XML schema [" + systemId + "]: " + resource, ex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return source; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
|