private Resource getTemplateResource(MortalLogger logger, String templatePath, ResourceOracle resourceOracle) throws UnableToCompleteException { Resource resource = resourceOracle.getResource(templatePath); if (null == resource) { logger.die("Unable to find resource: " + templatePath); } return resource; }
private Resource getTemplateResource(MortalLogger logger, String templatePath, ResourceOracle resourceOracle) throws UnableToCompleteException { Resource resource = resourceOracle.getResource(templatePath); if (null == resource) { logger.die("Unable to find resource: " + templatePath); } return resource; }
private List<StorageSerialization> findAllStorageSerializations() throws UnableToCompleteException{ logger.branch(TreeLogger.Type.DEBUG, "Find StorageSerialization XML"); List<StorageSerialization> storageSerializations = new ArrayList<>(); for(String pathName : resourceOracle.getPathNames()){ if(pathName.endsWith(SERIALIZATION_CONFIG)){ StorageSerialization storageSerialization = parseXmlResource(resourceOracle.getResource(pathName)); if(storageSerialization != null){ storageSerializations.add(storageSerialization); } } } return storageSerializations; }
/** * Get all related resources of the auto resource bundler. */ private HashSet<Resource> getResources(GeneratorContext context, JClassType userType, FileFilter filter) { final String pack = userType.getPackage().getName().replace('.', '/'); HashSet<Resource> resourceList = new HashSet<Resource>(); for (String path : context.getResourcesOracle().getPathNames()) { if (!path.startsWith(pack)) continue; String ext = getExtension(path); if (EXTENSION_MAP.containsKey(ext)) resourceList.add(context.getResourcesOracle().getResource(path)); } return resourceList; }
@Override public InputSource resolveEntity(String publicId, String systemId) { String matchingPrefix = findMatchingPrefix(systemId); Resource resource = null; if (matchingPrefix != null) { resource = resourceOracle.getResource(RESOURCES + systemId.substring(matchingPrefix.length())); } if (resource == null) { resource = resourceOracle.getResource(pathBase + systemId); } if (resource != null) { String content; try { InputStream resourceStream = resource.openContents(); content = Util.readStreamAsString(resourceStream); } catch (IOException ex) { logger.log(TreeLogger.ERROR, "Error reading resource: " + resource.getLocation()); throw new RuntimeException(ex); } InputSource inputSource = new InputSource(new StringReader(content)); inputSource.setPublicId(publicId); inputSource.setSystemId(resource.getPath()); return inputSource; } /* * Let Sax find it on the interweb. */ return null; }
/** * Get all related resources of the auto resource bundler. */ private HashSet<Resource> getResources(GeneratorContext context, JClassType userType, FileFilter filter) { final String pack = userType.getPackage().getName().replace('.', '/'); HashSet<Resource> resourceList = new HashSet<Resource>(); for (String path : context.getResourcesOracle().getPathNames()) { if (!path.startsWith(pack)) continue; String ext = getExtension(path); if (EXTENSION_MAP.containsKey(ext)) resourceList.add(context.getResourcesOracle().getResource(path)); } return resourceList; }
@Override public InputSource resolveEntity(String publicId, String systemId) { String matchingPrefix = findMatchingPrefix(systemId); Resource resource = null; if (matchingPrefix != null) { resource = resourceOracle.getResource(RESOURCES + systemId.substring(matchingPrefix.length())); } if (resource == null) { resource = resourceOracle.getResource(pathBase + systemId); } if (resource != null) { String content; try { InputStream resourceStream = resource.openContents(); content = Util.readStreamAsString(resourceStream); } catch (IOException ex) { logger.log(TreeLogger.ERROR, "Error reading resource: " + resource.getLocation()); throw new RuntimeException(ex); } InputSource inputSource = new InputSource(new StringReader(content)); inputSource.setPublicId(publicId); inputSource.setSystemId(resource.getPath()); return inputSource; } /* * Let Sax find it on the interweb. */ return null; }
String ext = "." + element.getExt(); String path = partialPath + ext; Resource resource = resourceOracle.getResource(path); if (resource == null && partialPath.contains("$")) { resource = resourceOracle.getResource(path);
String ext = "." + element.getExt(); String path = partialPath + ext; Resource resource = resourceOracle.getResource(path); if (resource == null && partialPath.contains("$")) { resource = resourceOracle.getResource(path);