mondo-project / mondo-hawk

Heterogeneous model indexing solution, based on NoSQL stores.
Eclipse Public License 2.0
17 stars 5 forks source link

QueryExecutionException when running EOL Query from Eclipse UI #78

Closed iamjonco closed 5 years ago

iamjonco commented 5 years ago

I am getting the following exception when running a standard EOL query from the Eclipse Query UI Dialog:

org.hawk.core.query.QueryExecutionException: org.hawk.timeaware.queries.TimeAwareEOLQueryEngine can only be used with time-aware backends at org.hawk.timeaware.queries.TimeAwareEOLQueryEngine.query(TimeAwareEOLQueryEngine.java:197) at org.hawk.osgiserver.HModel.query(HModel.java:437) at org.hawk.ui2.dialog.HQueryDialog$QueryExecutionSelectionAdapter$1.run(HQueryDialog.java:191) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)

Seems that it thinks the TimeAwareEOLQueryEngine is selected. Currently using the v1.2.0-rc4 release.

Current workaround is to NOT install the time aware engine

agarciadom commented 5 years ago

Are you using Hawk locally, or through the Thrift API (client-server)?

Could you try using the very latest version of Hawk? Use the update site in the README:

http://mondo-project.github.io/mondo-hawk/updates/

If you are using the server, grab the latest one from:

https://dl.bintray.com/bluezio/generic/

iamjonco commented 5 years ago

Hi Antonio

I believe I have identified the issue

org.hawk.timeaware.queries.TimeAwareEOLQueryEngine extends the standard EOLQueryEngine but does not override the getType() method. When the engines are registered, both try to map to the same name in the BaseModelIndexer overwriting any previous mapping. For whatever reason this is always TimeAware in my setup.

I've attached a pull request that implements a naive fix but am unsure of any further ramifications that this change would create.

As noted previously the current workaround is to not install the time aware components if they are not needed to prevent any registration conflicts between the query engines.

agarciadom commented 5 years ago

Oops, you are right. We did a recent refactoring where we based all Hawk plugin interfaces from an IHawkPlugin interface, which has a default implementation of getType() which uses the canonical name of the class.

This is working fine for most plugins, except just the TimeAwareEOLQueryEngine, which was extending EOLQueryEngine. EOLQueryEngine returns a fixed type for backwards compatibility with old clients.

Rather than your fix with another fixed string, I prefer to simply use getClass().getCanonicalName() as in the default implementation of IHawkPlugin#getType. Thanks for looking into this!