Загрузка файлов Mof / XMI в Eclipse через EMF - PullRequest
3 голосов
/ 20 марта 2012

Я хочу импортировать / загрузить xmi-файл на основе mof, который экспортируется Enterprise Architect 8.

 ResourceSet resourceSet_xmi = new ResourceSetImpl();
resourceSet_xmi.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new EMOFResourceFactoryImpl());

File file = new File(fileName);
URI uri = file.isFile() ? URI.createFileURI(file.getAbsolutePath()) : URI.createURI("D:\\Documents and Settings\\broehl_w\\My Documents\\test.xmi");

try {
  // Demand load resource for this file.
  //
  Resource resource = resourceSet_xmi.getResource(uri, true);
  System.out.println("Loaded " + uri);
  resource.save(System.out, null);
}
catch (Exception exception) {
  System.out.println("Problem loading " + uri);
  exception.printStackTrace();
}

Но это заканчивается исключением:

 org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'null' not found.

Смотретьфактический файл XMI (который был получен) не содержит URI.

Должен ли я это руководство, но что такое URI?

Заранее спасибо!

...