Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Trouble resolving packages using OCL within CDO
[CDO] Trouble resolving packages using OCL within CDO [message #1219026] Fri, 29 November 2013 18:53 Go to next message
Josh M is currently offline Josh MFriend
Messages: 22
Registered: July 2009
Junior Member
Hello!

I am having an issue when trying to execute OCL queries within a CDO environment. I am running a query that uses oclAsType and specifies a class (xxx::yyy::zzz). This query executes fine when using the console provided in the org.eclipse.ocl.examples.interpreter plugin, which looks like it is making use of the org.eclipse.ocl.examples.interpreter.console.DelegatingPackageRegistry. When I attempt to execute the same query string using org.eclipse.emf.cdo.view.CDOView.createQuery, I get the error: org.eclipse.ocl.SemanticException: Unknown type.

I traced this down to find that when org.eclipse.ocl.ecore.EcoreEnvironment attempts to load the package within the method findPackageByNSPrefix(List<String>, Registry), it cannot find the package. The immediate cause of this looks to be that this method is iterating on the registry looking for values of type org.eclipse.emf.ecore.EPackage, and the package that I need it to find is of type org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl, as it has not been loaded by the package registry on the CDO server (org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl).

Is there a way that I can tell the server to load this package from the client prior to my query/queries? I would be very grateful for any help you might offer trying to get passed this problem.

Thanks!
Re: [CDO] Trouble resolving packages using OCL within CDO [message #1219060 is a reply to message #1219026] Sat, 30 November 2013 14:26 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1199
Registered: July 2009
Location: Canada
Senior Member

Hi,

You can install the plug-in defining your EMF model in the CDO server
instance and use the <initialPackage> element in the cdo-server.xml
configuration to pre-load the package. Something like this:

<initialPackage nsURI="http://www.eclipse.org/uml2/4.0.0/UML"/>

HTH,

Christian


On 2013-11-29 18:53:46 +0000, Sed Mising name said:

> Hello!
>
> I am having an issue when trying to execute OCL queries within a CDO
> environment. I am running a query that uses oclAsType and specifies a
> class (xxx::yyy::zzz). This query executes fine when using the console
> provided in the org.eclipse.ocl.examples.interpreter plugin, which
> looks like it is making use of the
> org.eclipse.ocl.examples.interpreter.console.DelegatingPackageRegistry.
> When I attempt to execute the same query string using
> org.eclipse.emf.cdo.view.CDOView.createQuery, I get the error:
> org.eclipse.ocl.SemanticException: Unknown type.
> I traced this down to find that when
> org.eclipse.ocl.ecore.EcoreEnvironment attempts to load the package
> within the method findPackageByNSPrefix(List<String>, Registry), it
> cannot find the package. The immediate cause of this looks to be that
> this method is iterating on the registry looking for values of type
> org.eclipse.emf.ecore.EPackage, and the package that I need it to find
> is of type
> org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl, as it has
> not been loaded by the package registry on the CDO server
> (org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl).
>
> Is there a way that I can tell the server to load this package from the
> client prior to my query/queries? I would be very grateful for any
> help you might offer trying to get passed this problem.
>
> Thanks!
Re: [CDO] Trouble resolving packages using OCL within CDO [message #1219879 is a reply to message #1219060] Fri, 06 December 2013 14:04 Go to previous message
Josh M is currently offline Josh MFriend
Messages: 22
Registered: July 2009
Junior Member
Christian,
Thank you for your help! Your suggestion works well when starting up CDO server for the first time(org.eclipse.emf.cdo.spi.server.InternalStore.isFirstStart() == true), but if the server has already been initialized, I am not seeing the same success.

Our current implementation does not make use of a cdo-server.xml file, so I implemented your suggestion by calling setInitialPackages on the instance of our repository programmatically.

Is there a way to achieve the same outcome if we have a repository in a state such that isFirstStart returns false?

Thanks again for your help!
Previous Topic:[Texo] Modeling JoinColumns
Next Topic:Undo/Redo Actions Disabled
Goto Forum:
  


Current Time: Thu Dec 12 19:30:09 GMT 2019

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

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

Back to the top