Re: PROPOSAL: Extensions to XMIReader and XMIWriter interfaces
"Ronald Krijgsheld" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.devel |
|---|---|
| Message-ID | <002901c23562$76b3d7c0$9600000a@warhero> |
Yes, I already thought of that too, but still had to check if the XMI spec said something about a xmi.id format. From your remark, I conclude that that is not the case. So, I do not need the getLocation method. Ronald ----- Original Message ----- From: "Martin Matula" <[email protected]> To: <[email protected]> Sent: Saturday, July 27, 2002 1:32 PM Subject: Re: PROPOSAL: Extensions to XMIReader and XMIWriter interfaces > I would like to get rid of getLocation method. I think the cleaner > approach that does not even break the compliance is to encode the type > information in xmi.id part of href. Yes, it will make the XMI files > bigger a little bit, however I don't think it is a big deal - I think it > is a good price for staying compliant. > Martin > > > Brian Smith wrote: > > Krijgsheld, Ronald wrote: > > > >> Martin, > >> the name documentURI suggests a URI :). In your answer to Brian about any > >> restrictions on the, at that time, called XMIReference.getReference() > >> method, you said no. With this new proposal we go in another > >> direction, by, > >> at minimum, suggesting a format. Note, that I do not mind this. > > > > > > Sure, but it is just a suggestion. For example, you could map all of > > your objects to a virtual directory structure on your web server. E.g.: > > > > http://www.foo.com/models/mof/Model/ModelElement/name > > > > In this case, getDocumentURI() could return > > "http://www.foo.com/models/mof", getLocation() could return > > "/Model/ModelElement/name", and getXmiId() could return whatever you > > want it to. > > > > But, I expect that this type of thing would be rare. You would need a > > custom HrefResolver that worked fairly unintuitively. For the common > > case, the document URI will be a URI for a document ;) > > > > For what you want to do (encode the type in the link), you could do > > something like this: > > > > class CustomXMIReference extends SimpleXmiReference { > > CustomXMIReference(RefObject o, String documentURI, String id) { > > super(documentURI, id); > > } > > public String getLocation() { > > return super.getLocation() > > + ((ModelElement) refObject.refMetaObject()) > > .getQualifiedName().toString(); > > > > } > > } > > > > Then your links would look like > > "http://www.foo.com/mof.xml#String[Model, PrimitiveType]" > > > > Probably, you would want a prettier format for the name of the type (at > > the very least, you would probably want to get rid of the spaces). > > > > - Brian > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >