Re: [mdr-users] Cannot create URL
Martin Matula <[email protected]> Fri, 14 Oct 2005 11:44:14 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
The problem is you don't pass the URI to the read method - so, the
reader cannot resolve relative references. Instead of creating the
stream from URI yourself, pass the URI to the read method of XMI reader.
Martin
florimodo wrote:
> Sure, here's my snippet:
>
>
> String metaModelUri = "file:/home/flo/jmi/01-02-15_Diff.xml";
> String modelUri = "/home/flo/jmi/catalog.xml";
>
> System.setProperty("org.netbeans.mdr.storagemodel.StorageFactoryClassName",
> "org.netbeans.mdr.persistence.memoryimpl.StorageFactoryImpl");
>
> MDRepository repository = MDRManager.getDefault().getDefaultRepository();
>
> ModelPackage metaModelExtent =
> (ModelPackage)repository.createExtent(metaModelUri);
>
> XMIReader xmiReader = XMIReaderFactory.getDefault().createXMIReader();
> XMIWriter xmiWriter = XMIWriterFactory.getDefault().createXMIWriter();
>
> xmiReader.read(metaModelUri, metaModelExtent);
> Collection metaModells = metaModelExtent.getMofPackage().refAllOfClass();
>
> Iterator i = metaModells.iterator();
>
> MofPackage mofPackage;
>
> do {mofPackage = (MofPackage)i.next();}
> while(!"UML".equals(mofPackage.getName()));
>
> UmlPackage umlPackage = (UmlPackage)repository.createExtent("UML
> Instance", mofPackage);
>
> InputStream in = new FileInputStream(modelUri);
> xmiReader.read(in, null, umlPackage);
>
>
>> -------- Original Message --------
>> Subject: Re: [mdr-users] Cannot create URL
>> Date: Fri, 14 Oct 2005 07:57:43 +0200
>> From: Martin Matula <[email protected]>
>> Reply-To: [email protected]
>> To: [email protected]
>> References: <[email protected]>
>>
>>
>>
>> How do you read the document in? (Could you provide a code snippet?)
>> Martin
>>
>> florimodo wrote:
>>
>>> Hi,
>>>
>>> I am new to MDR and I think my problem should be easy to solve.
>>> Probably it has already been posted a couple of times but I didn't
>>> find anything yet.
>>>
>>> I am trying to read an XMI model generated with MagicDraw. I always
>>> get an error message like
>>>
>>> org.netbeans.lib.jmi.util.DebugException: Cannot create URL:
>>> andromda-profile.xml
>>>
>>> This also applies to all other profiles referenced by my uml model.
>>> However the profiles are all available in the same folder als my xmi,
>>> besides they are in the classpath but I still get this message.
>>>
>>> The solution is probably quite simple, but I am really stuck.
>>> Thanks in advance,
>>>
>>> flo
>>
>>
>>
>>
>>