|
Re: Load UML Model Standalone [message #475575 is a reply to message #475573] |
Fri, 31 August 2007 10:46 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------000904030408060306070901
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Matthias,
It sounds like these EMF FAQs:
2.17 I get a PackageNotFoundException: e.g., "Package with uri
'http://com.example.company.ecore' not found." What do I need to do?
< http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_PackageNot FoundException:_e.g..2C_.22Package_with_uri_.27http:.2F.2Fco m.example.company.ecore.27_not_found..22_What_do_I_need_to_d o.3F>
2.18 Do I have to pre-register my static, generated package when
running stand-alone (outside of Eclipse)?
< http://wiki.eclipse.org/index.php/EMF-FAQ#Do_I_have_to_pre-r egister_my_static.2C_generated_package_when_running_stand-al one_.28outside_of_Eclipse.29.3F>
Of course, being UML2, maybe this is solved some other way. It sounds
like your profile isn't being found so maybe you need to register that
profile like you would a dynamic package:
2.19 How do I register a dynamic package?
< http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_register_ a_dynamic_package.3F>
Matthias Krebber wrote:
> Hello,
> I have created a simple class diagram with magic draw 12.5 and
> exported it to EMF UML2 (v2.x).
>
> Now I want to load the created *.uml model standalone with mdt uml2.
> While trying to solve this task I get the following exception:
> Exception in thread "main"
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
> 'http:///schemas/MagicDrawProfile/_V6VvkFeMEdyvu96OURhT_Q/0' not found.
> How I have to register this package?
>
--------------000904030408060306070901
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
It sounds like these EMF FAQs:<br>
<blockquote><a style=""
href=" http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_PackageNot FoundException:_e.g..2C_.22Package_with_uri_.27http:.2F.2Fco m.example.company.ecore.27_not_found..22_What_do_I_need_to_d o.3F"><span
class="tocnumber">2.17</span> <span class="toctext">I get a
PackageNotFoundException: e.g., "Package with uri
'http://com.example.company.ecore' not found." What do I need to do?</span></a><br>
<a
href=" http://wiki.eclipse.org/index.php/EMF-FAQ#Do_I_have_to_pre-r egister_my_static.2C_generated_package_when_running_stand-al one_.28outside_of_Eclipse.29.3F"><span
class="tocnumber">2.18</span> <span class="toctext">Do I have to
pre-register my static, generated package when running stand-alone
(outside of Eclipse)?</span></a><br>
</blockquote>
Of course, being UML2, maybe this is solved some other way.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Load UML Model Standalone [message #475780 is a reply to message #475779] |
Thu, 06 September 2007 12:40 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------000801000100080804010806
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Matthias,
It generally seems better to me to use either this because it's more
efficient
URI.createFileURI(new File(pathUMLModel).getAbsolutePath())
or to use this which is a bit less efficient but relies on the JVM to
produce the correct file URI:
URI.createURI(new File(pathUMLModel).toURI().toString())
I'm not sure I see the value in creating an intermediate URL especially
when java.io.File has a toURL method.
Matthias Krebber wrote:
> Thank you for this precious information.
>
> That means that I will register it as follows:
> pathUMLModel = "file:/" + new File(pathUMLModel).getAbsolutePath();
> Resource res = rs.getResource(URI.createURI(new
> URL(pathUMLModel).toString(),true),true);
> Matthias
>
--------------000801000100080804010806
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
It generally seems better to me to use either this because it's more
efficient<br>
<blockquote>URI.createFileURI(new File(pathUMLModel).getAbsolutePath())<br>
</blockquote>
or to use this which is a bit less efficient but relies on the JVM to
produce the correct file URI:<br>
<blockquote>URI.createURI(new File(pathUMLModel).toURI().toString())<br>
</blockquote>
I'm not sure I see the value in creating an intermediate URL especially
when java.io.File has a toURL method.<br>
<br>
<br>
Matthias Krebber wrote:
<blockquote
cite="mid:f32edb1db01bd10a447caa20e36b2929$1@www.eclipse.org"
type="cite">Thank you for this precious information.
<br>
<br>
That means that I will register it as follows:
<br>
pathUMLModel = <a class="moz-txt-link-rfc2396E" href="file:/">"file:/"</a> + new File(pathUMLModel).getAbsolutePath();
<br>
Resource res = rs.getResource(URI.createURI(new
URL(pathUMLModel).toString(),true),true);
<br>
Matthias
<br>
<br>
</blockquote>
<br>
</body>
</html>
--------------000801000100080804010806--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Load UML Model Standalone [message #624602 is a reply to message #475573] |
Fri, 31 August 2007 10:46 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------000904030408060306070901
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Matthias,
It sounds like these EMF FAQs:
2.17 I get a PackageNotFoundException: e.g., "Package with uri
'http://com.example.company.ecore' not found." What do I need to do?
< http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_PackageNot FoundException:_e.g..2C_.22Package_with_uri_.27http:.2F.2Fco m.example.company.ecore.27_not_found..22_What_do_I_need_to_d o.3F>
2.18 Do I have to pre-register my static, generated package when
running stand-alone (outside of Eclipse)?
< http://wiki.eclipse.org/index.php/EMF-FAQ#Do_I_have_to_pre-r egister_my_static.2C_generated_package_when_running_stand-al one_.28outside_of_Eclipse.29.3F>
Of course, being UML2, maybe this is solved some other way. It sounds
like your profile isn't being found so maybe you need to register that
profile like you would a dynamic package:
2.19 How do I register a dynamic package?
< http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_register_ a_dynamic_package.3F>
Matthias Krebber wrote:
> Hello,
> I have created a simple class diagram with magic draw 12.5 and
> exported it to EMF UML2 (v2.x).
>
> Now I want to load the created *.uml model standalone with mdt uml2.
> While trying to solve this task I get the following exception:
> Exception in thread "main"
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
> 'http:///schemas/MagicDrawProfile/_V6VvkFeMEdyvu96OURhT_Q/0' not found.
> How I have to register this package?
>
--------------000904030408060306070901
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
It sounds like these EMF FAQs:<br>
<blockquote><a style=""
href=" http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_PackageNot FoundException:_e.g..2C_.22Package_with_uri_.27http:.2F.2Fco m.example.company.ecore.27_not_found..22_What_do_I_need_to_d o.3F"><span
class="tocnumber">2.17</span> <span class="toctext">I get a
PackageNotFoundException: e.g., "Package with uri
'http://com.example.company.ecore' not found." What do I need to do?</span></a><br>
<a
href=" http://wiki.eclipse.org/index.php/EMF-FAQ#Do_I_have_to_pre-r egister_my_static.2C_generated_package_when_running_stand-al one_.28outside_of_Eclipse.29.3F"><span
class="tocnumber">2.18</span> <span class="toctext">Do I have to
pre-register my static, generated package when running stand-alone
(outside of Eclipse)?</span></a><br>
</blockquote>
Of course, being UML2, maybe this is solved some other way.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
|
|
Re: Load UML Model Standalone [message #624724 is a reply to message #475771] |
Wed, 05 September 2007 15:30 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Mathias,
Are you registering just "uml" or literally "*.uml"? You need to do
the former.
Mathias Krebber wrote:
> Hi,
> I have another question. Is it possible only to register the accordant
> file extensions without explicitly register the
> Resource.Factory.Registry.DEFAULT_EXTENSION. Because if I do not
> register the default extension in my application with a default
> factory but register for example the *.uml extension with a uml
> factory I get an error. "a registered resource factory is needed".
> If I try to load a *.uml model always the registered default factory
> for default extension is used.
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Load UML Model Standalone [message #624726 is a reply to message #475773] |
Wed, 05 September 2007 16:52 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Mathias,
That looks right then. My guess would be that you are loading a
resource that has neither "xmi" extension nor "uml" extension in order
to get the message about no factory being registered. What is the URI
of the resource being created when you get that message?
Mathias Krebber wrote:
> Hi,
> thank you for the reply.
> I register it that way:
> Map<String,Object> globalExtensionMap =
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( );
> globalExtensionMap.put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> globalExtensionMap.put(XMIResource.XMI_NS, new XMIResourceFactoryImpl());
> ..
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Re: Load UML Model Standalone [message #624730 is a reply to message #475777] |
Thu, 06 September 2007 12:03 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Matthias,
A URI with a scheme that's not immediately followed by a "/" is an
opaque URI rather than a hierarchical URI and an opaque URI only has an
opaquePart rather than a path. The file extension of a URI is the
string after that last "." in the last segment of the path, so an opaque
URI doesn't have such a thing since it doesn't have a path.
Matthias Krebber wrote:
> Hi,
> I found a solutions to solve my problem.
> If I load my UML Model as follows:
> if (!pathUMLModel.startsWith("file:")) { pathUMLModel = "file:" +
> new File(pathUMLModel).getAbsolutePath(); }
> Resource res = rs.getResource(URI.createURI(new
> URL(pathUMLModel).toString(),true),true);
>
> I get the exception: ... a registered resource factory is needed
> Only if i register the default extension it works.
>
> If I load the model as follows:
> Resource res = rs.getResource(URI.createFileURI(new
> File(pathUMLModel).getAbsolutePath()),true);
> It works fine.
> Can you explain me why?
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Load UML Model Standalone [message #624732 is a reply to message #475779] |
Thu, 06 September 2007 12:40 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------000801000100080804010806
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Matthias,
It generally seems better to me to use either this because it's more
efficient
URI.createFileURI(new File(pathUMLModel).getAbsolutePath())
or to use this which is a bit less efficient but relies on the JVM to
produce the correct file URI:
URI.createURI(new File(pathUMLModel).toURI().toString())
I'm not sure I see the value in creating an intermediate URL especially
when java.io.File has a toURL method.
Matthias Krebber wrote:
> Thank you for this precious information.
>
> That means that I will register it as follows:
> pathUMLModel = "file:/" + new File(pathUMLModel).getAbsolutePath();
> Resource res = rs.getResource(URI.createURI(new
> URL(pathUMLModel).toString(),true),true);
> Matthias
>
--------------000801000100080804010806
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthias,<br>
<br>
It generally seems better to me to use either this because it's more
efficient<br>
<blockquote>URI.createFileURI(new File(pathUMLModel).getAbsolutePath())<br>
</blockquote>
or to use this which is a bit less efficient but relies on the JVM to
produce the correct file URI:<br>
<blockquote>URI.createURI(new File(pathUMLModel).toURI().toString())<br>
</blockquote>
I'm not sure I see the value in creating an intermediate URL especially
when java.io.File has a toURL method.<br>
<br>
<br>
Matthias Krebber wrote:
<blockquote
cite="mid:f32edb1db01bd10a447caa20e36b2929$1@www.eclipse.org"
type="cite">Thank you for this precious information.
<br>
<br>
That means that I will register it as follows:
<br>
pathUMLModel = <a class="moz-txt-link-rfc2396E" href="file:/">"file:/"</a> + new File(pathUMLModel).getAbsolutePath();
<br>
Resource res = rs.getResource(URI.createURI(new
URL(pathUMLModel).toString(),true),true);
<br>
Matthias
<br>
<br>
</blockquote>
<br>
</body>
</html>
--------------000801000100080804010806--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|