Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Loading XMI with profile and stereotypes failes
Loading XMI with profile and stereotypes failes [message #625236] Sat, 20 October 2007 10:48
Reinhard Jeschull is currently offline Reinhard JeschullFriend
Messages: 10
Registered: July 2009
Junior Member
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;
}
Previous Topic:uml2ecore, ecore attributes marked as volatile
Next Topic:A complete specification of UML2
Goto Forum:
  


Current Time: Sat Apr 27 04:05:39 GMT 2024

Powered by FUDForum. Page generated in 0.02820 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top