|
|
Re: Loading XMI with profile and stereotypes failes [message #476418 is a reply to message #476403] |
Tue, 23 October 2007 20:52 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Reinhard,
I noticed that you did not "define" your profile. Select your profile from
the UML editor and select 'UML Editor > Profile > Define'.
Please have a look at
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html.
I tried defining your profile and it worked much better but you are
importing a package called uml.xml (I'm not sure where that is coming from)
..
Cheers,
- James.
"Reinhard Jeschull" <rjeschu@fh-landshut.de> wrote in message
news:4b34a1e66d48175eb84ab3d567ccf30f$1@www.eclipse.org...
> Hi,
> I am trying to load XMIs with UML2 2.1. That works perfect until I tried
> to add a profile to use stereotypes. My little XMI (test file) with a
> profile is at the bottom of this message. Its a class with stereotype
> <<SUT>>.
> After loading it, I get the following exception:
>
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'SUT' not found.
> (<path_to_file>, 26, 80)
>
> Is there something wrong with the XMI file or with the code (below the XMI
> file)?
>
> Thanks a lot for your help.
>
> ------------------------------------------------------------ ----------------
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xmi:XMI xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML" version="2.1">
> <uml:Model xmi:type="uml:Model" name="EA_Model" visibility="public">
> <packagedElement xmi:type="uml:Package"
> xmi:id="EAPK_B8A6DE1E_4D59_45d1_8B7C_3E6287069B33" name="Model"
> visibility="public">
> <packagedElement xmi:type="uml:Package"
> xmi:id="EAPK_435BFDBD_22EF_452c_BF09_ADE83276D12D" name="Class Model"
> visibility="public">
> <packagedElement xmi:type="uml:Class"
> xmi:id="EAID_5D161DA1_C258_471b_AC2C_E41C7B86F7F4" name="Device"
> visibility="public" />
> </packagedElement>
> </packagedElement>
> </uml:Model>
> <uml:Profile xmlns:namespace-prefix="thecustomprofile" xmi:version="2.1"
> xmi:id="thecustomprofile" name="thecustomprofile"
> metamodelReference="mmref01">
> <ownedComment xmi:type="uml:Comment" xmi:id="comment01"
> annotatedElement="thecustomprofile">
> <body>Version:1.0</body>
> </ownedComment>
> <packageImport xmi:id="mmref01">
> <importedPackage href="http://www.eclipse.org/uml2/2.1.0/UML/uml.xml" />
> </packageImport>
> <packagedElement xmi:type="uml:Stereotype" xmi:id="SUT" name="SUT">
> <ownedAttribute xmi:type="uml:Property" xmi:id="SUT-base_Class"
> name="base_Class" association="Class_SUT">
> <type xmi:type="uml:PrimitiveType"
> href="http://www.eclipse.org/uml2/2.1.0/UML/uml.xml#Class" />
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension" xmi:id="Class_SUT"
> name="A_Class_SUT" memberEnd="extension_SUT SUT-base_Class">
> <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="extension_SUT"
> name="extension_SUT" type="SUT" isComposite="true" lower="0" upper="1" />
> </packagedElement>
> </uml:Profile>
> <thecustomprofile:SUT
> base_Class="EAID_5D161DA1_C258_471b_AC2C_E41C7B86F7F4"/>
> </xmi:XMI>
>
>
> ------------------------------------------------------------ ----------------
> static public org.eclipse.uml2.uml.Package load(URI uri)
> {
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "xmi",
> new XMIResourceFactoryImpl());
> UMLPackage.eINSTANCE.eClass();
>
> org.eclipse.uml2.uml.Package p = null;
> try
> {
> Resource resource = resourceSet.getResource(uri, true); p =
> (org.eclipse.uml2.uml.Package)
> EcoreUtil.getObjectByType(resource.getContents(),
> UMLPackage.eINSTANCE.getPackage());
> }
> catch (Exception e)
> {
> e.printStackTrace();
> }
>
> return p;
> }
>
|
|
|
|
|
Re: Loading XMI with profile and stereotypes failes [message #625297 is a reply to message #476403] |
Tue, 23 October 2007 20:52 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Reinhard,
I noticed that you did not "define" your profile. Select your profile from
the UML editor and select 'UML Editor > Profile > Define'.
Please have a look at
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html
I tried defining your profile and it worked much better but you are
importing a package called uml.xml (I'm not sure where that is coming from)
..
Cheers,
- James.
"Reinhard Jeschull" <rjeschu@fh-landshut.de> wrote in message
news:4b34a1e66d48175eb84ab3d567ccf30f$1@www.eclipse.org...
> Hi,
> I am trying to load XMIs with UML2 2.1. That works perfect until I tried
> to add a profile to use stereotypes. My little XMI (test file) with a
> profile is at the bottom of this message. Its a class with stereotype
> <<SUT>>.
> After loading it, I get the following exception:
>
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'SUT' not found.
> (<path_to_file>, 26, 80)
>
> Is there something wrong with the XMI file or with the code (below the XMI
> file)?
>
> Thanks a lot for your help.
>
> ------------------------------------------------------------ ----------------
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xmi:XMI xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML" version="2.1">
> <uml:Model xmi:type="uml:Model" name="EA_Model" visibility="public">
> <packagedElement xmi:type="uml:Package"
> xmi:id="EAPK_B8A6DE1E_4D59_45d1_8B7C_3E6287069B33" name="Model"
> visibility="public">
> <packagedElement xmi:type="uml:Package"
> xmi:id="EAPK_435BFDBD_22EF_452c_BF09_ADE83276D12D" name="Class Model"
> visibility="public">
> <packagedElement xmi:type="uml:Class"
> xmi:id="EAID_5D161DA1_C258_471b_AC2C_E41C7B86F7F4" name="Device"
> visibility="public" />
> </packagedElement>
> </packagedElement>
> </uml:Model>
> <uml:Profile xmlns:namespace-prefix="thecustomprofile" xmi:version="2.1"
> xmi:id="thecustomprofile" name="thecustomprofile"
> metamodelReference="mmref01">
> <ownedComment xmi:type="uml:Comment" xmi:id="comment01"
> annotatedElement="thecustomprofile">
> <body>Version:1.0</body>
> </ownedComment>
> <packageImport xmi:id="mmref01">
> <importedPackage href="http://www.eclipse.org/uml2/2.1.0/UML/uml.xml" />
> </packageImport>
> <packagedElement xmi:type="uml:Stereotype" xmi:id="SUT" name="SUT">
> <ownedAttribute xmi:type="uml:Property" xmi:id="SUT-base_Class"
> name="base_Class" association="Class_SUT">
> <type xmi:type="uml:PrimitiveType"
> href="http://www.eclipse.org/uml2/2.1.0/UML/uml.xml#Class" />
> </ownedAttribute>
> </packagedElement>
> <packagedElement xmi:type="uml:Extension" xmi:id="Class_SUT"
> name="A_Class_SUT" memberEnd="extension_SUT SUT-base_Class">
> <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="extension_SUT"
> name="extension_SUT" type="SUT" isComposite="true" lower="0" upper="1" />
> </packagedElement>
> </uml:Profile>
> <thecustomprofile:SUT
> base_Class="EAID_5D161DA1_C258_471b_AC2C_E41C7B86F7F4"/>
> </xmi:XMI>
>
>
> ------------------------------------------------------------ ----------------
> static public org.eclipse.uml2.uml.Package load(URI uri)
> {
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "xmi",
> new XMIResourceFactoryImpl());
> UMLPackage.eINSTANCE.eClass();
>
> org.eclipse.uml2.uml.Package p = null;
> try
> {
> Resource resource = resourceSet.getResource(uri, true); p =
> (org.eclipse.uml2.uml.Package)
> EcoreUtil.getObjectByType(resource.getContents(),
> UMLPackage.eINSTANCE.getPackage());
> }
> catch (Exception e)
> {
> e.printStackTrace();
> }
>
> return p;
> }
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03430 seconds