[CDO] Trouble resolving packages using OCL within CDO [message #1219026] |
Fri, 29 November 2013 13:53  |
Eclipse User |
|
|
|
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 09:26   |
Eclipse User |
|
|
|
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 09:04  |
Eclipse User |
|
|
|
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!
|
|
|
Powered by
FUDForum. Page generated in 0.02933 seconds