Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » iterating over the URI Registry
iterating over the URI Registry [message #418223] Sun, 06 April 2008 17:37 Go to next message
Eclipse UserFriend
Originally posted by: comouraf-lixo.yahoo.fr

Hi,

I'd like to print the URIs of all registered metamodels. The following
snippet doesn't help much, cause it only prints the ecore URI (and the fake
"myURI" created in the code):

EPackage.Registry registry = EPackage.Registry.INSTANCE;
(2) EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
(3) registry.put("http://myURI.com", pack);
for(String uri: registry.keySet()){
System.out.println(uri);
}

What should I do? Of course I didn't want to have all plugins loaded into
memory, just check their URIs. Another question: I can only see the Ecore
URI if I first register the fake URI ("myURI" ) . That is, if I remove lines
2 and 3 from the snippet above, I see nothing. Why is it?

Thanks

Cesar
Re: iterating over the URI Registry [message #418224 is a reply to message #418223] Sun, 06 April 2008 18:52 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Cesar,

I'll have to assume you're running standalone, because otherwise all the
global package registered via the plugin.xml registrations for the
generated_package/dynamic_package extension points would appear. When
running standalone, a package will only register itself the first time
XyzPackage.eINSTANCE is accessed. So if you did
EcorePackage.eINSTANCE.eClass(), for example, you'd see the
EcorePackage's nsURI being registered and the same goes for any other
packages..


kaiserlautern wrote:
> Hi,
>
> I'd like to print the URIs of all registered metamodels. The following
> snippet doesn't help much, cause it only prints the ecore URI (and the
> fake "myURI" created in the code):
>
> EPackage.Registry registry = EPackage.Registry.INSTANCE;
> (2) EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
> (3) registry.put("http://myURI.com", pack);
> for(String uri: registry.keySet()){
> System.out.println(uri);
> }
>
> What should I do? Of course I didn't want to have all plugins loaded
> into memory, just check their URIs. Another question: I can only see
> the Ecore URI if I first register the fake URI ("myURI" ) . That is,
> if I remove lines 2 and 3 from the snippet above, I see nothing. Why
> is it?
>
> Thanks
>
> Cesar


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Interim Update Site not recognized by p2
Next Topic:Problems with model that references UML::Model
Goto Forum:
  


Current Time: Thu Apr 25 02:25:39 GMT 2024

Powered by FUDForum. Page generated in 0.02760 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top