Home » Modeling » UML2 » Re: [UML2] how to load UML_PRIMITIVE_TYPES_LIBRARY
| | |
Re: [UML2] how to load UML_PRIMITIVE_TYPES_LIBRARY [message #477022 is a reply to message #477021] |
Tue, 04 March 2008 10:36 |
Jinhui Messages: 42 Registered: July 2009 |
Member |
|
|
Hi Kenn,
Thanks for the advice.
Well, it seemed that the URI
"pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml" has to be resolved
manually, otherwise it could not be resolved by EMF. (I always got the
"MalformedURLException")
So I solved the problem like this:
* I extract the "UMLPrimitiveTypes.library.uml" from the JAR file, and
save it in my current project dir.
* and then register the the pathmap-URI with with the physical one(the one
in my project dir), and now I was able to load the primitive type lib and
get the primitive types.
Jinhui
The code looks like this:
ResourceSet RESOURCE_SET = new
RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
RESOURCE_SET.getResourceFactoryRegistry().getExtensionToFact oryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
Map uriMap = RESOURCE_SET.getURIConverter().getURIMap();
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "uml",
new UMLResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "*",
new XMIResourceFactoryImpl());
URIConverter.URI_MAP.put(URI.createURI("pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml"),
URI.createFileURI(System.getProperty("user.dir") +
"/Model_Libs/UMLPrimitiveTypes.library.uml"));
Resource resource =
RESOURCE_SET.getResource(URI.createURI(UMLResource.UML_PRIMI TIVE_TYPES_LIBRARY_URI),
true);
Kenn Hussey wrote:
> Jinhui,
> Its sounds like a resource factory has not been registered to hande the URI
> you are trying load. The FAQ entry that I pointed you to shows how to do
> this:
|
|
|
Re: [UML2] how to load UML_PRIMITIVE_TYPES_LIBRARY [message #477023 is a reply to message #477022] |
Tue, 04 March 2008 15:53 |
Kenn Hussey Messages: 1620 Registered: July 2009 |
Senior Member |
|
|
Jinhui,
What string did you try using for the base JAR URL? I've done this many
times in the past (as per the FAQ) and never had a problem...
Kenn
"Jinhui" <zhuj@in.tum.de> wrote in message
news:0026a798a8951e2cfe35598bcf00db2e$1@www.eclipse.org...
> Hi Kenn,
> Thanks for the advice.
>
> Well, it seemed that the URI
> "pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml" has to be resolved
> manually, otherwise it could not be resolved by EMF. (I always got the
> "MalformedURLException")
>
> So I solved the problem like this: * I extract the
> "UMLPrimitiveTypes.library.uml" from the JAR file, and save it in my
> current project dir.
> * and then register the the pathmap-URI with with the physical one(the one
> in my project dir), and now I was able to load the primitive type lib and
> get the primitive types.
>
> Jinhui
>
> The code looks like this:
>
> ResourceSet RESOURCE_SET = new
> RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> RESOURCE_SET.getResourceFactoryRegistry().getExtensionToFact oryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map uriMap = RESOURCE_SET.getURIConverter().getURIMap();
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "uml",
> new UMLResourceFactoryImpl());
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "*", new
> XMIResourceFactoryImpl());
> URIConverter.URI_MAP.put(URI.createURI("pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml"),
> URI.createFileURI(System.getProperty("user.dir") +
> "/Model_Libs/UMLPrimitiveTypes.library.uml"));
>
> Resource resource =
> RESOURCE_SET.getResource(URI.createURI(UMLResource.UML_PRIMI TIVE_TYPES_LIBRARY_URI),
> true);
>
>
> Kenn Hussey wrote:
>
>> Jinhui,
>
>> Its sounds like a resource factory has not been registered to hande the
>> URI you are trying load. The FAQ entry that I pointed you to shows how to
>> do this:
>
>
|
|
| | | | | | |
Re: [UML2] how to load UML_PRIMITIVE_TYPES_LIBRARY [message #626126 is a reply to message #477021] |
Tue, 04 March 2008 10:36 |
Jinhui Messages: 42 Registered: July 2009 |
Member |
|
|
Hi Kenn,
Thanks for the advice.
Well, it seemed that the URI
"pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml" has to be resolved
manually, otherwise it could not be resolved by EMF. (I always got the
"MalformedURLException")
So I solved the problem like this:
* I extract the "UMLPrimitiveTypes.library.uml" from the JAR file, and
save it in my current project dir.
* and then register the the pathmap-URI with with the physical one(the one
in my project dir), and now I was able to load the primitive type lib and
get the primitive types.
Jinhui
The code looks like this:
ResourceSet RESOURCE_SET = new
RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
RESOURCE_SET.getResourceFactoryRegistry().getExtensionToFact oryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
Map uriMap = RESOURCE_SET.getURIConverter().getURIMap();
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "uml",
new UMLResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "*",
new XMIResourceFactoryImpl());
URIConverter.URI_MAP.put(URI.createURI("pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml"),
URI.createFileURI(System.getProperty("user.dir") +
"/Model_Libs/UMLPrimitiveTypes.library.uml"));
Resource resource =
RESOURCE_SET.getResource(URI.createURI(UMLResource.UML_PRIMI TIVE_TYPES_LIBRARY_URI),
true);
Kenn Hussey wrote:
> Jinhui,
> Its sounds like a resource factory has not been registered to hande the URI
> you are trying load. The FAQ entry that I pointed you to shows how to do
> this:
|
|
|
Re: [UML2] how to load UML_PRIMITIVE_TYPES_LIBRARY [message #626127 is a reply to message #477022] |
Tue, 04 March 2008 15:53 |
Kenn Hussey Messages: 1620 Registered: July 2009 |
Senior Member |
|
|
Jinhui,
What string did you try using for the base JAR URL? I've done this many
times in the past (as per the FAQ) and never had a problem...
Kenn
"Jinhui" <zhuj@in.tum.de> wrote in message
news:0026a798a8951e2cfe35598bcf00db2e$1@www.eclipse.org...
> Hi Kenn,
> Thanks for the advice.
>
> Well, it seemed that the URI
> "pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml" has to be resolved
> manually, otherwise it could not be resolved by EMF. (I always got the
> "MalformedURLException")
>
> So I solved the problem like this: * I extract the
> "UMLPrimitiveTypes.library.uml" from the JAR file, and save it in my
> current project dir.
> * and then register the the pathmap-URI with with the physical one(the one
> in my project dir), and now I was able to load the primitive type lib and
> get the primitive types.
>
> Jinhui
>
> The code looks like this:
>
> ResourceSet RESOURCE_SET = new
> RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> RESOURCE_SET.getResourceFactoryRegistry().getExtensionToFact oryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
> Map uriMap = RESOURCE_SET.getURIConverter().getURIMap();
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "uml",
> new UMLResourceFactoryImpl());
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "*", new
> XMIResourceFactoryImpl());
> URIConverter.URI_MAP.put(URI.createURI("pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml"),
> URI.createFileURI(System.getProperty("user.dir") +
> "/Model_Libs/UMLPrimitiveTypes.library.uml"));
>
> Resource resource =
> RESOURCE_SET.getResource(URI.createURI(UMLResource.UML_PRIMI TIVE_TYPES_LIBRARY_URI),
> true);
>
>
> Kenn Hussey wrote:
>
>> Jinhui,
>
>> Its sounds like a resource factory has not been registered to hande the
>> URI you are trying load. The FAQ entry that I pointed you to shows how to
>> do this:
>
>
|
|
| | | | |
Goto Forum:
Current Time: Sat Sep 21 15:39:57 GMT 2024
Powered by FUDForum. Page generated in 0.05941 seconds
|