Hi,
Thanks for your answer. I solved it for the standalone jar.
For the profile it was actually very easy:
uriMap.put(URI.createFileURI(profileDefaultLocation),
URI.createFileURI(customUserLocation)); where uriMap is resourceSet.getURIConverter().getURIMap()
and profileDefaultLocation is the hardcoded String which references the profile in the model.uml.
I had to do the same for a uml file containing custom types. In this case, the uriMap did not do the trick.
Instead I had to implement my own URIConverter and override getURIHandler(URI uri) like this:
private class MyUriConverter extends ExtensibleURIConverterImpl {
private boolean overrideUmlTypes;
@Override
public URIHandler getURIHandler(URI uri) {
if(overrideUmlTypes && umlTypesRelativeName.equals(uri.lastSegment())) {
return new FileURIHandlerImpl() {
@Override
public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException {
File file = configuration.getCustomTypesLocation();
InputStream inputStream = new FileInputStream(file);
// no idea what this does, just copied it from parent implementation
Map<Object, Object> response = getResponse(options);
if (response != null)
{
response.put(URIConverter.RESPONSE_TIME_STAMP_PROPERTY, file.lastModified());
}
return inputStream;
}
};
} else {
return super.getURIHandler(uri);
}
}
public void setOverrideUmlTypes(boolean overrideUmlTypes) {
this.overrideUmlTypes = overrideUmlTypes;
}
}
where
umlTypesRelativeName is again the String referencing the uml file containing the type definitions. This String is also hardcoded into the model.