Skip to content

Commit

Permalink
schema file from resource folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshhewabi committed Apr 9, 2021
1 parent d23de57 commit a9ce931
Show file tree
Hide file tree
Showing 3 changed files with 1,856 additions and 7 deletions.
9 changes: 4 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<archive.repo.version>1.0.2</archive.repo.version>
<px.submission.core.version>2.0.28</px.submission.core.version>
<ms.data.core.api.version>2.0.31-SNAPSHOT</ms.data.core.api.version>
<javax.activation.version>1.2.0</javax.activation.version>
<jaxb.api.version>2.3.1</jaxb.api.version>
<pia.version>1.3.15</pia.version>
Expand All @@ -34,10 +33,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<!--<exclusion>-->
<!--<groupId>org.apache.logging.log4j</groupId>-->
<!--<artifactId>log4j-slf4j-impl</artifactId>-->
<!--</exclusion>-->
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
Expand Down Expand Up @@ -180,6 +175,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -24,7 +25,7 @@ public class MzIdValidator implements Validator{

private File file;
private List<File> peakFiles;
private static final String MZID_SCHEMA = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/psi-pi/mzIdentML1.1.0.xsd";
// private static final String MZID_SCHEMA = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/psi-pi/mzIdentML1.1.0.xsd";

public static Validator getInstance(CommandLine cmd) throws Exception {
return new MzIdValidator(cmd);
Expand Down Expand Up @@ -86,7 +87,11 @@ private static IReport validateMzidSchema(File mzIdentML) {
IReport report = new ResultReport();
try (BufferedReader br = new BufferedReader(new FileReader(mzIdentML))) {
GenericSchemaValidator genericValidator = new GenericSchemaValidator();
genericValidator.setSchema(new URI(MzIdValidator.MZID_SCHEMA));
URL url = MzIdValidator.class.getClassLoader().getResource("mzIdentML1.1.0.xsd");
if (url == null || url.getPath().length() == 0) {
throw new IllegalStateException("MzIdentML1.1.0.xsd not found!");
}
genericValidator.setSchema(url.toURI());
ErrorHandlerIface handler = new ValidationErrorHandler();
genericValidator.setErrorHandler(handler);
genericValidator.validate(br);
Expand Down
Loading

0 comments on commit a9ce931

Please sign in to comment.