I have a large edmx schema file that would be very inconvenient to manually re-create, one EntityType at a time, in Java using OLingo. While I'm not opposed to writing a loader of some kind, I wanted to make sure that OLingo 4 doesn't already provide this functionality.
I found an article that shows how OLingo 2 can load this kind of information:
@Override
public Edm readMetadata(final InputStream inputStream, final boolean validate)
throws EntityProviderException {
EdmProvider provider = new EdmxProvider().parse(inputStream, validate);
return new EdmImplProv(provider);
}
But I need to use version 4. I haven't found the same interfaces in the documentation for version 4, so I'm at a bit of a loss. Any pointers much appreciated.
After more investigation, I found that I needed the odata-server-core-ext package and I could import org.apache.olingo.server.core.MetadataParser
. Among other things, this class has a function called buildEdmProvider(Reader)
which does the work of building a SchemaBasedEdmProvider
for you.