public void exportToXMI(String filename) {
   XMIWriterFactory factory = XMIWriterFactory.getDefault();
   XMIWriter writer = factory.createXMIWriter();
   writer.getConfiguration().setEncoding("UTF-8");
   try {
     writer.write(new FileOutputStream(filename), spagobiPackage, "1.2"); // $NON-NLS-1$
   } catch (Throwable t) {
     throw new RuntimeException("Impossible to export cwm model [" + name + "] to xmi", t);
   }
 }
 public void write() throws UmlException {
   XMIWriter xmiWriter = XMIWriterFactory.getDefault().createXMIWriter(config);
   try {
     modelImpl.getRepository().beginTrans(false);
     try {
       RefPackage extent = ((RefObject) model).refOutermostPackage();
       xmiWriter.write(oStream, "file:///ThisIsADummyName.xmi", extent, XMI_VERSION);
     } finally {
       // end our transaction
       modelImpl.getRepository().endTrans();
     }
   } catch (IOException e) {
     throw new UmlException(e);
   }
 }