public void validate(File file) throws IOException { validate(file, file.getName()); }
private SchemaValidator createValidator(File schemaDir, String schemaFile) { try { File file = new File(schemaDir + File.separator + "schema" + File.separator + schemaFile); return new SchemaValidator(file, new BaseDeployLogger()); } catch (SAXException e) { throw new RuntimeException("Invalid schema '" + schemaFile + "'", e); } catch (IOException e) { throw new RuntimeException("IO error reading schema '" + schemaFile + "'", e); } }
/** * Initializes the validator by using the given file as schema file * * @param schemaFile schema file * @throws IOException if it is not possible to read schema files */ SchemaValidator(File schemaFile, DeployLogger deployLogger) throws IOException, SAXException { this.deployLogger = deployLogger; this.driver = new ValidationDriver(PropertyMap.EMPTY, instanceProperties(), CompactSchemaReader.getInstance()); driver.loadSchema(ValidationDriver.fileInputSource(schemaFile)); }
public void validate(Reader reader) throws IOException { validate(new InputSource(reader), null); }
private void validateRouting(SchemaValidator validator, Tuple2<File, String> directory) throws IOException { File dir = directory.first; if ( ! dir.isDirectory()) return; String directoryName = directory.second; for (File f : dir.listFiles(xmlFilter)) { if (f.isDirectory()) validateRouting(validator, new Tuple2<>(f, directoryName + File.separator + f.getName())); else validator.validate(f, directoryName + File.separator + f.getName()); } }
public void validate(File file, String fileName) throws IOException { validate(ValidationDriver.fileInputSource(file), fileName); }
private void validate(SchemaValidator validator, String filename) throws IOException { validator.validate(appDirs.file(filename)); }
public void validate(NamedReader reader) throws IOException { validate(new InputSource(reader), reader.getName()); }
public static void checkServices(Reader reader, Version version) throws IOException { new SchemaValidators(version).servicesXmlValidator().validate(reader); } }
public void checkIncludedDirs(ApplicationPackage app) throws IOException { for (String includedDir : app.getUserIncludeDirs()) { List<NamedReader> includedFiles = app.getFiles(Path.fromString(includedDir), ".xml", true); for (NamedReader file : includedFiles) { validators.containerIncludeXmlValidator().validate(file); } } }
private void validate(ApplicationPackage appPkg) throws IOException { if (!validate) { return; } SchemaValidators schemaValidators = new SchemaValidators(new Version(VespaVersion.major)); if (appPkg.getHosts() != null) { schemaValidators.hostsXmlValidator().validate(appPkg.getHosts()); } schemaValidators.servicesXmlValidator().validate(appPkg.getServices()); } }