Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [] Overwrite custom UML profile


Thanks for your answer. I solved it for the standalone jar.

For the profile it was actually very easy:


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;

        public URIHandler getURIHandler(URI uri) {
            if(overrideUmlTypes && umlTypesRelativeName.equals(uri.lastSegment())) {
                return new FileURIHandlerImpl() {

                    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.

Then I just passed the custom URI converter to the resource set:

resourceSet.setURIConverter(new MyUriConverter());

Like this, no running eclipse instance is necessary, ie it can be done in a standalone jar.

Best regards,

On Fri, Feb 23, 2018 at 10:22 AM, Ansgar Radermacher <ansgar.radermacher@xxxxxx> wrote:

you may use a reference based on a PATHMAP and a URI mapping normally registered by a plugin, as shown below. If you apply the profile registered this way, references towards the profile in your model will be based on the pathmap. Thus, you could relocate the profile and adapt the URI mapping accordingly. However, I don't know how to use that in a headless configuration, i.e. out of Eclipse.

            source="pathmap://your ID/"
            target="your path ...">

            name="Your profile name"
            path="pathmap://your ID/your profile.profile.uml"

Best regards


PS: It would be good to pass by the Papyrus forum for this question

On 21/02/2018 09:37, Christoph Czurda wrote:

I have a UML file, myModel.uml. The model references a profile, myProfile.uml, in various places.

For example:

xsi:schemaLocation="http:///schemas/MyNamespace/_yEh3IAjnEei6dL15TtaBqw/30 ../ myProfileProject/myProfile.uml#_yEk6cAjnEei6dL15TtaBqw" >

<references xmi:type="ecore:EPackage" href="">myProfile.uml#_yEk6cAjnEei6dL15TtaBqw"/>

 I am writing a standalone Java application, so I load the model and the resources on my own. As you can see from the code snippets, the profile is referenced via relative path. As long as the user has his paths accordingly, everything works fine. However, for convenience I want to add a command line parameter to the standalone app where the user can specifiy the profile location.

How can I apply the profile to the loaded model, should the user specify a different location? I tried adding the profile from the custom path to the resource set, but the model still cannot resolve the profile, due to the relative paths hardcoded into the model.uml I suppose.

Kind regards,

_______________________________________________ mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

_______________________________________________ mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top