Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » UnRegistered Package Predicament
UnRegistered Package Predicament [message #426475] Wed, 07 January 2009 18:21 Go to next message
Geoffry Roberts is currently offline Geoffry RobertsFriend
Messages: 71
Registered: July 2009
Member
All,

Is there any way to register a package if all one has available is either
the nsURI or the fully qualified class name of a class in the package?

A situation has reared its ugly head and I am at bit of a loss as to what
to do.

I am transporting emf models between computers by serializing them into
strings and shooting them through the wire. This all works well enough
until it comes time to deserialize them back into emf. On occasion--and
this is one of those intermittent things--the deserialize fails because
the package has not yet been registered. I need a way to force a
registration when the critical moment arises.

Here's is what I have to work with: A java.lang.Class of the emf object
and that's it! I can use the class name to determine the nsURI. I can
also assemble a qualified name of the package for the class in question.
This is possible because of the naming conventions I have adopted, but I
am less than sanguine about going this route. Heaven help me if I break
those conventions.

Thanks
Re: UnRegistered Package Predicament [message #426478 is a reply to message #426475] Wed, 07 January 2009 19:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33145
Registered: July 2009
Senior Member
Geoffry,

Comments below.


Geoffry Roberts wrote:
> All,
>
> Is there any way to register a package if all one has available is
> either the nsURI or the fully qualified class name of a class in the
> package?
Class<?> javaClass = Class.forName(className);
Field field = javaClass.getField("eINSTANCE");
> A situation has reared its ugly head and I am at bit of a loss as to
> what to do.
>
> I am transporting emf models between computers by serializing them
> into strings and shooting them through the wire. This all works well
> enough until it comes time to deserialize them back into emf. On
> occasion--and this is one of those intermittent things--the
> deserialize fails because the package has not yet been registered. I
> need a way to force a registration when the critical moment arises.
You might find OPTION_SCHEMA_LOCATION_IMPLEMENTATION useful. It
effectively writes out, as part of the xsi:schemaLocation, the
interface name of the package and does the above logic automatically
during loading...
>
> Here's is what I have to work with: A java.lang.Class of the emf
> object and that's it! I can use the class name to determine the
> nsURI. I can also assemble a qualified name of the package for the
> class in question. This is possible because of the naming
> conventions I have adopted, but I am less than sanguine about going
> this route. Heaven help me if I break those conventions.
Of course if you generally know what packages are involved, calling
XyzPackage.eINSTANCE.eClass() for every package you know you will/might
need, should suffice...
>
> Thanks
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: UnRegistered Package Predicament [message #426481 is a reply to message #426475] Wed, 07 January 2009 20:08 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6683
Registered: July 2009
Senior Member
Geoffry,

I'm really not sure about the nature of your effort, but some words in
your note made me think that the CDO model repository and distributed
shared model framework could help you. Perhaps our approach to send
ad-hoc models and meta models through the wires (and store them in a
central repository) could be helpful for you. You could have a look at
our wiki: http://wiki.eclipse.org/CDO

Please tell me if you are interested and nedd more infos...

Cheers
/Eike

----
http://thegordian.blogspot.com



Geoffry Roberts schrieb:
> All,
>
> Is there any way to register a package if all one has available is
> either the nsURI or the fully qualified class name of a class in the
> package?
> A situation has reared its ugly head and I am at bit of a loss as to
> what to do.
>
> I am transporting emf models between computers by serializing them
> into strings and shooting them through the wire. This all works well
> enough until it comes time to deserialize them back into emf. On
> occasion--and this is one of those intermittent things--the
> deserialize fails because the package has not yet been registered. I
> need a way to force a registration when the critical moment arises.
>
> Here's is what I have to work with: A java.lang.Class of the emf
> object and that's it! I can use the class name to determine the
> nsURI. I can also assemble a qualified name of the package for the
> class in question. This is possible because of the naming
> conventions I have adopted, but I am less than sanguine about going
> this route. Heaven help me if I break those conventions.
>
> Thanks
>


Re: UnRegistered Package Predicament [message #426482 is a reply to message #426481] Wed, 07 January 2009 21:22 Go to previous messageGo to next message
Geoffry Roberts is currently offline Geoffry RobertsFriend
Messages: 71
Registered: July 2009
Member
Eike Stepper wrote:

> Geoffry,

> I'm really not sure about the nature of your effort, but some words in
> your note made me think that the CDO model repository and distributed
> shared model framework could help you. Perhaps our approach to send
> ad-hoc models and meta models through the wires (and store them in a
> central repository) could be helpful for you. You could have a look at
> our wiki: http://wiki.eclipse.org/CDO

> Please tell me if you are interested and nedd more infos...

> Cheers
> /Eike

> ----
> http://thegordian.blogspot.com



> Geoffry Roberts schrieb:
>> All,
>>
>> Is there any way to register a package if all one has available is
>> either the nsURI or the fully qualified class name of a class in the
>> package?
>> A situation has reared its ugly head and I am at bit of a loss as to
>> what to do.
>>
>> I am transporting emf models between computers by serializing them
>> into strings and shooting them through the wire. This all works well
>> enough until it comes time to deserialize them back into emf. On
>> occasion--and this is one of those intermittent things--the
>> deserialize fails because the package has not yet been registered. I
>> need a way to force a registration when the critical moment arises.
>>
>> Here's is what I have to work with: A java.lang.Class of the emf
>> object and that's it! I can use the class name to determine the
>> nsURI. I can also assemble a qualified name of the package for the
>> class in question. This is possible because of the naming
>> conventions I have adopted, but I am less than sanguine about going
>> this route. Heaven help me if I break those conventions.
>>
>> Thanks
>>
I noticed CDO sometime back but have had neither the time nor mental
bandwidth to dig into it. Tell me this, can it do what teneo does?
Re: UnRegistered Package Predicament [message #426488 is a reply to message #426482] Thu, 08 January 2009 04:54 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6683
Registered: July 2009
Senior Member
Geoffry,

Yes, it does not describe completely what CDO can do, but it can
basically do what Teneo can. We even have one kind of backend
integration that is based on Teneo. From this perspective one could say
that CDO adds a network distribution layer between Teneo/Hiobernate/DB
and EMF.

Cheers
/Eike

----
http://thegordian.blogspot.com



Geoffry Roberts schrieb:
> Eike Stepper wrote:
>
>> Geoffry,
>
>> I'm really not sure about the nature of your effort, but some words
>> in your note made me think that the CDO model repository and
>> distributed shared model framework could help you. Perhaps our
>> approach to send ad-hoc models and meta models through the wires (and
>> store them in a central repository) could be helpful for you. You
>> could have a look at our wiki: http://wiki.eclipse.org/CDO
>
>> Please tell me if you are interested and nedd more infos...
>
>> Cheers
>> /Eike
>
>> ----
>> http://thegordian.blogspot.com
>
>
>
>> Geoffry Roberts schrieb:
>>> All,
>>>
>>> Is there any way to register a package if all one has available is
>>> either the nsURI or the fully qualified class name of a class in the
>>> package? A situation has reared its ugly head and I am at bit of a
>>> loss as to what to do.
>>>
>>> I am transporting emf models between computers by serializing them
>>> into strings and shooting them through the wire. This all works
>>> well enough until it comes time to deserialize them back into emf.
>>> On occasion--and this is one of those intermittent things--the
>>> deserialize fails because the package has not yet been registered.
>>> I need a way to force a registration when the critical moment arises.
>>>
>>> Here's is what I have to work with: A java.lang.Class of the emf
>>> object and that's it! I can use the class name to determine the
>>> nsURI. I can also assemble a qualified name of the package for the
>>> class in question. This is possible because of the naming
>>> conventions I have adopted, but I am less than sanguine about going
>>> this route. Heaven help me if I break those conventions.
>>>
>>> Thanks
>>>
> I noticed CDO sometime back but have had neither the time nor mental
> bandwidth to dig into it. Tell me this, can it do what teneo does?
>


Previous Topic:[cdo] Using RecordingCommands and CDO
Next Topic:Resource loading
Goto Forum:
  


Current Time: Wed May 08 01:53:34 GMT 2024

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

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

Back to the top