The EDM Parser is designed to parse the metadata document.
To make the parser accessible from the API, we have to implement the method readMetadata
from interface org.apache.olingo.odata2.api.ep.EntityProviderInterface
:
@Override
public Edm readMetadata(final InputStream inputStream, final boolean validate) throws EntityProviderException {
EdmProvider provider = new EdmxProvider().parse(inputStream, validate);
return new EdmImplProv(provider);
}
The signature contains the InputStream
that represents a data stream read from a file and flag validate. If validate is set to true, the structure of the metadata will be checked according to the CSDL after parsing. For example: it will be validated that each EntityType
defines a key element or derives from a BaseType
that for its part defines a key.
To start the parsing we have to follow the next steps:
EdmxProvider
. This class derives from EdmProvider
and provides implementations for all of its abstract methodsparse(InputStream, boolean)
of this objectReturned is an EDM object that contains the complete information from parsed metadata.
Copyright © 2013-2023, The Apache Software Foundation
Apache Olingo, Olingo, Apache, the Apache feather, and
the Apache Olingo project logo are trademarks of the Apache Software
Foundation.