[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.uml2] PackageNotFoundException
|
Hi,
I have two profiles (mad and madui) that I applied for building a sample UML
model. When I created the sample model, I loaded the two workspace resources
corresponding to the profiles into the model. After that, the uml text seems
like:
<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:mad="http:///schemas/mad/0" xmlns:madui="http:///schemas/madui/0"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
xsi:schemaLocation="http:///schemas/mad/0
../com.vetta.mad.profile/mad.profile.uml#_YJX-cFV8Edu8PNPhXpmxfA
http:///schemas/madui/0
../com.vetta.mad.profile/mad.ui.profile.uml#_Uw_JgVWAEdu8PNPhXpmxfA">
However, when I try to programattically load the uml resource (see code
excerpt below) I get the following exception:
org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
'http:///schemas/mad/0' not found.
(file:/D:/workspace/giacomin/runtime-madness/madness.tests/sample.uml, 27,
92)
protected org.eclipse.uml2.uml.Package load(URI uri) {
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put
("uml", new XMIResourceFactoryImpl());
org.eclipse.uml2.uml.Package package_ = null;
try {
Resource resource = resourceSet.getResource(uri, true);
package_ = (org.eclipse.uml2.uml.Package)
EcoreUtil.getObjectByType(
resource.getContents(), UMLPackage.Literals.PACKAGE);
} catch (WrappedException we) {
System.err.println(we.getMessage());
}
return package_;
}
Any hints? Also, is there a good reference about resource, resourcesets,
etc. available somewhere?
Best,
--
Ricardo Giacomin