[EMF] [message #946667] |
Tue, 16 October 2012 07:35  |
Eclipse User |
|
|
|
Hi Everyone,
I need to load a ecore file from my classpath
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put( "*", new EcoreResourceFactoryImpl() );
final String[] ecores = new String[] { "classpath:models//library.ecore" };
for( String ecore : ecores ) {
final Resource res = resourceSet.getResource( URI.createFileURI(ecore ), true );}...
But it is not working.
Can somebody tell me the correct way?
Thanks,
Appasamy
|
|
|
Re: [EMF] [message #946723 is a reply to message #946667] |
Tue, 16 October 2012 08:46   |
Eclipse User |
|
|
|
hi, Appasamy,
What does "not working" mean? Do you get an exception? If so, what
exception and with what message? Do you get a resource and it just has
no contents? Is this in an Eclipse context where you can see
exceptions logged in the workspace log? There are so many reasons why
this resource might not load as you would expect ...
Cheers,
Christian
On 2012-10-16 11:35:47 +0000, Appasamy Thirugnana said:
> Hi Everyone,
>
> I need to load a ecore file from my classpath
>
> ResourceSet resourceSet = new ResourceSetImpl();
>
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
> "*", new EcoreResourceFactoryImpl() );
>
> final String[] ecores = new String[] {
> "classpath:models//library.ecore" };
>
> for( String ecore : ecores ) {
> final Resource res = resourceSet.getResource(
> URI.createFileURI(ecore ), true );}...
>
> But it is not working.
>
> Can somebody tell me the correct way?
>
> Thanks,
> Appasamy
|
|
|
|
Re: [EMF] [message #946732 is a reply to message #946723] |
Tue, 16 October 2012 08:54   |
Eclipse User |
|
|
|
Hi
classpath URIs are an innovation introduced by MWE; they are unlikely to
work in EMF without following the appropriate MWE initialization orocedures.
Regards
Ed Willink
On 16/10/2012 13:46, Christian W. Damus wrote:
> hi, Appasamy,
>
> What does "not working" mean? Do you get an exception? If so, what
> exception and with what message? Do you get a resource and it just
> has no contents? Is this in an Eclipse context where you can see
> exceptions logged in the workspace log? There are so many reasons why
> this resource might not load as you would expect ...
>
> Cheers,
>
> Christian
>
>
> On 2012-10-16 11:35:47 +0000, Appasamy Thirugnana said:
>
>> Hi Everyone,
>>
>> I need to load a ecore file from my classpath
>>
>> ResourceSet resourceSet = new ResourceSetImpl();
>>
>>
>> resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
>> "*", new EcoreResourceFactoryImpl() );
>>
>> final String[] ecores = new String[] {
>> "classpath:models//library.ecore" };
>>
>> for( String ecore : ecores ) {
>> final Resource res = resourceSet.getResource(
>> URI.createFileURI(ecore ), true );}...
>>
>> But it is not working.
>>
>> Can somebody tell me the correct way?
>>
>> Thanks,
>> Appasamy
>
>
|
|
|
|
|
Re: [EMF] [message #947795 is a reply to message #947541] |
Wed, 17 October 2012 08:53  |
Eclipse User |
|
|
|
FrameworkUtil is located in the package 'org.osgi.framework' (add org.eclipse.core.runtime or import package org.osgi.framwork).
Thoug, as the other try to tell you: your questions are ambiguous and I am just guessing...
Appasamy Thirugnana wrote on Wed, 17 October 2012 03:11Thanks Christian, Ed, and Erdal.
Meanwhile I am not able to find FrameworkUtil class in my package as I have only EMF Core jars in my project.
Can you please let me know which package I can get this.
Currently I am using below packages:
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>2.7.0.v20120127-1122</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
<version>2.7.0.v20120127-1122</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
<version>2.7.0.v20120127-1122</version>
</dependency>
|
|
|
Powered by
FUDForum. Page generated in 0.11203 seconds