Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » What's the best way to package and share OQL queries
What's the best way to package and share OQL queries [message #656031] Wed, 23 February 2011 19:57 Go to next message
Krishna R is currently offline Krishna RFriend
Messages: 5
Registered: February 2011
Junior Member

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,
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 Go to previous message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 152
Registered: July 2009
Senior Member
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.

Previous Topic:Analyzing a tomcat instance started using sysdeo
Next Topic:ClassLoader analysis and IBM .phd files
Goto Forum:

Current Time: Sun Feb 23 08:35:59 GMT 2020

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

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

Back to the top