public InputSource resolveEntity(String publicId, String systemId) { log.debug("Trying to resolve XML entity with public ID [{}] and system ID [{}]", publicId, systemId); if (systemId != null && systemId.indexOf(DozerConstants.XSD_NAME) > systemId.lastIndexOf("/")) { String fileName = systemId.substring(systemId.indexOf(DozerConstants.XSD_NAME)); log.debug("Trying to locate [{}] in classpath", fileName); try { DozerClassLoader classLoader = BeanContainer.getInstance().getClassLoader(); URL url = classLoader.loadResource(fileName); InputStream stream = url.openStream(); InputSource source = new InputSource(stream); source.setPublicId(publicId); source.setSystemId(systemId); log.debug("Found beanmapping XML Schema [{}] in classpath", systemId); return source; } catch (Exception ex) { log.error("Could not resolve beanmapping XML Schema [" + systemId + "]: not found in classpath", ex); } } // use the default behaviour -> download from website or wherever return null; } }
public InputSource resolveEntity(String publicId, String systemId) { log.debug("Trying to resolve XML entity with public ID [{}] and system ID [{}]", publicId, systemId); if (systemId != null && systemId.indexOf(DozerConstants.XSD_NAME) > systemId.lastIndexOf("/")) { String fileName = systemId.substring(systemId.indexOf(DozerConstants.XSD_NAME)); log.debug("Trying to locate [{}] in classpath", fileName); try { DozerClassLoader classLoader = BeanContainer.getInstance().getClassLoader(); URL url = classLoader.loadResource(fileName); InputStream stream = url.openStream(); InputSource source = new InputSource(stream); source.setPublicId(publicId); source.setSystemId(systemId); log.debug("Found beanmapping XML Schema [{}] in classpath", systemId); return source; } catch (Exception ex) { log.error("Could not resolve beanmapping XML Schema [" + systemId + "]: not found in classpath", ex); } } // use the default behaviour -> download from website or wherever return null; } }
URL url = classLoader.loadResource(propFileName); if (url == null) { log.warn("Dozer configuration file not found: {}. Using defaults for all Dozer global properties.", propFileName);
public MappingFileData read(String fileName) { DozerClassLoader classLoader = BeanContainer.getInstance().getClassLoader(); URL url = classLoader.loadResource(fileName); return read(url); }
public MappingFileData read(String fileName) { DozerClassLoader classLoader = BeanContainer.getInstance().getClassLoader(); URL url = classLoader.loadResource(fileName); return read(url); }
URL url = classLoader.loadResource(propFileName); if (url == null) { log.warn("Dozer configuration file not found: {}. Using defaults for all Dozer global properties.",
public static URL validateURL(String fileName) { DozerClassLoader classLoader = BeanContainer.getInstance().getClassLoader(); if (fileName == null) { MappingUtils.throwMappingException("File name is null"); } URL url = classLoader.loadResource(fileName); if (url == null) { MappingUtils.throwMappingException("Unable to locate dozer mapping file [" + fileName + "] in the classpath!"); } InputStream stream = null; try { stream = url.openStream(); } catch (IOException e) { MappingUtils.throwMappingException("Unable to open URL input stream for dozer mapping file [" + url + "]"); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { MappingUtils.throwMappingException("Unable to close input stream for dozer mapping file [" + url + "]"); } } } return url; }
public static URL validateURL(String fileName) { DozerClassLoader classLoader = BeanContainer.getInstance().getClassLoader(); if (fileName == null) { MappingUtils.throwMappingException("File name is null"); } URL url = classLoader.loadResource(fileName); if (url == null) { MappingUtils .throwMappingException("Unable to locate dozer mapping file [" + fileName + "] in the classpath!"); } InputStream stream = null; try { stream = url.openStream(); } catch (IOException e) { MappingUtils.throwMappingException("Unable to open URL input stream for dozer mapping file [" + url + "]"); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { MappingUtils .throwMappingException("Unable to close input stream for dozer mapping file [" + url + "]"); } } } return url; }