[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[epf-dev] Huge problem with getting info from the xmi files of EPF


Hi, Good Afternoon...

I'm from Colombia and I send this message as a last resource, because I posted my problem in the EPF forum but till now It' got about 7500 but 0 answer...

So, here's the thing:

I'm trying to get the information stored in the xmi files from EPF, for example from the "plugin.xmi" but nothin seems to work for me, because everytime when I try to get in to the file.xmi I get an exception like:

 org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http:///org/eclipse/epf/uma/resourcemanager.ecore' not found. (file:/D:/Eclipse%20Definitivo/Eclipse/workspace/PDG/export.xmi, 3, 118)

here's my short code:

public static Resource loadModel(String xmlFile) throws Exception {

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getLoadOptions().put(XMIResource.OPTION_SCHEMA_LOCATION_IMPLEMENTATION, Boolean.TRUE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new XMIResourceFactoryImpl());
Resource resource = resourceSet.getResource(URI.createFileURI(new File(xmlFile).getAbsolutePath()),true);

return resource;
}

I tried another way and I get this:

java.lang.NoClassDefFoundError: org/eclipse/core/runtime/CoreException

here's the code:

ResourceSet resourceSet = new ResourceSetImpl();
final ExtendedMetaData extendedMetaData = new 
BasicExtendedMetaData(resourceSet.getPackageRegistry());
resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, 
extendedMetaData);
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, 
UMLPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(NotationPackage.eNS_URI , 
NotationPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(ModelPackage.eNS_URI, 
ModelPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(UmaPackage.eNS_URI, 
UmaPackage.eINSTANCE);
System.out.println("URI = " + ModelPackage.eNS_URI);
resourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, 
EcorePackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put( "xmi", 
new XMIResourceFactoryImpl());
URI fileURI = URI.createFileURI(new File("export.xmi").getAbsolutePath());

Resource resource = resourceSet.getResource(fileURI, true);

Ok, that would be all... if you could help me with this... 
I mean, how can I get into the xmi file to be able to use the EPF api?....

or if you a short code of how to do it...  that would be awsome...

Thank you son much....