What's the best way to package and share OQL queries [message #656031] |
Wed, 23 February 2011 19:57  |
Eclipse User |
|
|
|
Hello,
What is the best way to share OQL queries with others? I have written a bunch of queries which do some stuff, unfortunately there are a lot of people who don't know much about writing the queries, neither the classnames, but are interested in the results.
I have written some queries and packaged into plugins, but I didn't find the way how to package OQL queries into plugins.
I experimented with "org.eclipse.mat.inspections.OQLQuery" by writing an IQuery implementation that does the following:
public IResult execute(IProgressListener listener)
throws Exception
{
OQLQuery queryObject = new OQLQuery();
queryObject.snapshot = this.snapshot;
queryObject.queryString = "SELECT s, toString(s) from java.lang.String ";
return queryObject.execute(listener);
}
This didn't work initially (failed with a ClassNotFound for OQLQuery class), I made it to work by modifying Manifest file in MAT api jar, and added "org.eclipse.mat.inspections" package to Export-packages.
Agree that this is not the right way, but would like to know what is the cleanest way to do the same.
Any pointers would be helpful!
Thank you,
Krishna
|
|
|
Re: What's the best way to package and share OQL queries [message #656638 is a reply to message #656031] |
Sun, 27 February 2011 19:56  |
Eclipse User |
|
|
|
One way is this:
String query = "SELECT s, toString(s) from java.lang.String s";
IResult ir = SnapshotQuery.lookup("oql", snapshot).setArgument("queryString", query).execute(listener);
Supplied queries aren't actually part of the Memory Analyzer API, but this is cleaner than linking directly to that query.
|
|
|
Powered by
FUDForum. Page generated in 0.03496 seconds