[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.mdt.uml2] Re: Reading general XMI file
|
Hi Tom,
I think this may be more of an EMF question regarding how to work with
ResourceSets you may want to try to post there for a more complete response.
One issue you will face will be to properly register packages with your
resource set.
Something like:
Map packageRegistry = resourceSet.getPackageRegistry();
packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
You will also probably need to register extensions:
Map extensionFactoryMap =
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
extensionFactoryMap.put(UMLResource.FILE_EXTENION,
UMLResource.Factory.INSTANCE);
The UML project also makes uses of pathmaps so you will need something like:
URIConverter.URI_MAP.put(URI.create(UMLResource.LIBRARIES_PATHMP),
umlResourcePluginURI.appendSegment("libraries").appendSegment(""));
I would recommend downloading the UML2 examples and plugins and see how it
makes use of extensions.
There is also some example code here (scroll toward the bottom):
http://www.eclipse.org/modeling/mdt/uml2/docs/guides/UML2_2.0_Migration_Guide/guide.html
The EMF newsgroup also has many Q/A regarding ResourceSets.
Cheers,
- James.
"Tom" <tom@xxxxxxxxxxxx> wrote in message
news:h3no08$7pr$1@xxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I'm new the subject of parsing an XMI file with the eclipse libraries.
> I've read the "EMF Framework Programmer's Guide" and "Getting Started with
> UML2" in the UML2 wiki. I also googled a lot, but I could not find the
> right information on how my problem is solved or even an indication if it
> can be solved.
>
> I have a XMI file that has nothing to do with EMF/Ecore. The file contains
> a metamodel, unlike most guides (which seem only to work with concrete
> datamodels in their xmi files). This metamodel can for instance be a class
> diagram exported from IBM's Rational Rose or Visual Paradigm. I want to
> write an application that reads the classifiers and their associations
> from this XMI file. I believe it has to be possible to transform the
> metamodel to some Ecore object-set that can be browsed in Java. Am I
> correct?
>
> If so, how should I configure a ResourceSet to load the XMI file in this
> way? I tried using the UMLPackage.eINSTANCE in my code but with no succes,
> because I don't seem to understand the core concepts of ResourceSets and
> how I might configure them to load any XMI file. There seem to be an
> overwhelming amount of settings for Resouces that are to my knowledge not
> covered in some tutorial.
>
> Ideas? Sample source code would be highly appreciated :-)
>
> Regards,
> Tom