public class CessdaMetadataValidatorFactory extends Object implements ValidationService
Constructor and Description |
---|
CessdaMetadataValidatorFactory() |
Modifier and Type | Method and Description |
---|---|
static Set<String> |
getConstraints()
Return a set of all known constraints.
|
static ValidationGate |
getValidationGate(ValidationGateName name)
Returns a validation gate with the given name.
|
Document |
newDocument(Document document)
Parse the XML contained in the request to a
Document . |
Document |
newDocument(File file)
Parse the XML at the given file into a
Document . |
Document |
newDocument(InputSource inputSource)
Parse the given XML into a
Document . |
Document |
newDocument(InputStream inputStream)
Parse the XML located at the given URL into a
Document . |
Document |
newDocument(Path path)
Parse the XML at the given path into a
Document . |
Document |
newDocument(URI uri)
Parse the XML located at the given URI into a
Document . |
Document |
newDocument(URL url)
Parse the XML located at the given URL into a
Document . |
Profile |
newProfile(Document profile)
Parse the XML represented by the given request into a
Profile . |
Profile |
newProfile(File file)
Parse the XML located at the given file into a
Profile . |
Profile |
newProfile(InputSource inputSource)
Parse the XML represented by the given input source into a
Profile . |
Profile |
newProfile(InputStream inputStream)
Parse the XML represented by the given input stream into a
Profile . |
Profile |
newProfile(Path path)
Parse the XML located at the given path into a
Profile . |
Profile |
newProfile(URI uri)
Parse the XML located at the given URI into a
Profile . |
Profile |
newProfile(URL url)
Parse the XML located at the given URL into a
Profile . |
static ValidationGate |
newValidationGate(Collection<String> constraints)
Returns a validation gate for the given constraints.
|
ValidationService |
newValidationService()
Returns this as a validation service for compatibility with previous versions of CMV
|
ValidationReport |
validate(Document document,
Profile profile,
ValidationGate validationGate)
Validates the document against the given profile using the specified validation gate.
|
ValidationReport |
validate(URI documentUri,
URI profileUri,
ValidationGate validationGate)
Validates the document against the given profile using the specified validation gate.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
validate, validate
public Document newDocument(File file) throws IOException, NotDocumentException
Document
. The XML document must be either a DDI document
or an OAI-PMH document with a valid DDI document in the <metadata>
element.file
- the file where the XML to be parsed is located.NotDocumentException
- if the XML is not well-formed.IOException
- if an IO error occurs.public Document newDocument(Path path) throws IOException, NotDocumentException
Document
. The XML document must be either a DDI document
or an OAI-PMH document with a valid DDI document in the <metadata>
element.path
- the path where the XML to be parsed is located.NotDocumentException
- if the XML is not well-formed.IOException
- if an IO error occurs.public Document newDocument(URI uri) throws IOException, NotDocumentException
Document
. The XML document must be either a DDI document
or an OAI-PMH document with a valid DDI document in the <metadata>
element.uri
- the URI where the XML to be parsed is located.NotDocumentException
- if the XML is not well-formed.IOException
- if an IO error occurs.newDocument(URL)
using URI.toURL()
to transform the URI to a URL.public Document newDocument(URL url) throws IOException, NotDocumentException
Document
. The XML document must be either a DDI document
or an OAI-PMH document with a valid DDI document in the <metadata>
element.url
- the URL where the XML to be parsed is located.NotDocumentException
- if the XML is not well-formed.IOException
- if an IO error occurs.public Document newDocument(InputStream inputStream) throws IOException, NotDocumentException
Document
. The XML document must be either a DDI document
or an OAI-PMH document with a valid DDI document in the <metadata>
element.inputStream
- the input stream of the XML to be parsed.NotDocumentException
- if the XML is not well-formed.IOException
- if an IO error occurs.public Document newDocument(Document document) throws IOException, NotDocumentException
Document
. The XML document must be either a DDI document
or an OAI-PMH document with a valid DDI document in the <metadata>
element.document
- the request document.NotDocumentException
- if the XML is not well-formed.IOException
- if an IO error occurs.public static ValidationGate getValidationGate(ValidationGateName name)
public Profile newProfile(URI uri) throws NotDocumentException, IOException
Profile
. The XML document must be a valid DDI profile.uri
- the URI of the XML to parse.NotDocumentException
- if the XML is not well-formed, or no valid constraints were found.IOException
public Profile newProfile(URL url) throws NotDocumentException, IOException
Profile
. The XML document must be a valid DDI profile.url
- the URL of the XML to parse.NotDocumentException
- if the XML is not well-formed, or no valid constraints were found.IOException
public Profile newProfile(File file) throws NotDocumentException, IOException
Profile
. The XML document must be a valid DDI profile.file
- the file where the XML to be parsed is located.NotDocumentException
- if the XML is not well-formed, or no valid constraints were found.IOException
public Profile newProfile(Path path) throws NotDocumentException, IOException
Profile
. The XML document must be a valid DDI profile.path
- the path where the XML to be parsed is located.NotDocumentException
- if the XML is not well-formed, or no valid constraints were found.IOException
public Profile newProfile(InputStream inputStream) throws NotDocumentException, IOException
Profile
.
The XML document must be a valid DDI profile.inputStream
- the input stream of the XML to be parsed.NotDocumentException
- if the XML is not well-formed, or no valid constraints were found.IOException
public Profile newProfile(Document profile) throws NotDocumentException, IOException
Profile
.
The XML document must be a valid DDI profile.profile
- the request containing the XML to be parsed.NotDocumentException
- if the XML is not well-formed, or no valid constraints were found.IOException
public Profile newProfile(InputSource inputSource) throws NotDocumentException, IOException
Profile
.
The XML document must be a valid DDI profile.inputSource
- the input source of the XML to be parsed.NotDocumentException
- if the XML is not well-formed, or no valid constraints were found.IOException
public static ValidationGate newValidationGate(Collection<String> constraints) throws InvalidGateException
constraints
- the constraints to be addedInvalidGateException
- if any of the given constraints are invalidpublic static Set<String> getConstraints()
This should be used with newValidationGate(Collection)
to ensure that a validation gate is not constructed with invalid constraints.
public Document newDocument(InputSource inputSource) throws IOException, NotDocumentException
Document
. The XML document must be either a DDI document or an
OAI-PMH document with a valid DDI document in the <metadata>
element.inputSource
- the input source of the XML to be parsed.NotDocumentException
- if the XML is not well-formed.IOException
- if an IO error occurs.public ValidationReport validate(URI documentUri, URI profileUri, ValidationGate validationGate) throws IOException, NotDocumentException
validate
in interface ValidationService
documentUri
- the URI of the document to validate.profileUri
- the URI of the profile to validate the document against.validationGate
- the validation gate to use.IOException
NotDocumentException
public ValidationReport validate(Document document, Profile profile, ValidationGate validationGate)
validate
in interface ValidationService
document
- the document to validate.profile
- the profile to validate the document against.validationGate
- the validation gate to use.public ValidationService newValidationService()
Copyright © 2025 CESSDA ERIC. All rights reserved.