Cannot get extension report to be found. [message #892828] |
Sat, 30 June 2012 02:52 |
Stephen McGruer Messages: 4 Registered: June 2012 |
Junior Member |
|
|
Hi there.
I created a plugin extension for MAT following the instructions at wiki.eclipse.org/MemoryAnalyzer/Extending_Memory_Analyzer, targetting a new report (and query) instead. Unfortunately, I've been unable to get MAT to recognize that my report is there. To launch my code, I am doing:
* Run As -> Run Configurations
* Set 'Run An Application' to 'org.eclipse.mat.api.parse'
* Set the Program arguments to '/path/to/my/test/heap org.eclipse.mat.api:my_first_query'
When I hit Run, I just get an error that the report is not found. ("Report not found: org.eclipse.mat.api:my_first_query").
What is the correct way to associate my report & query with MAT? At the moment, I have registered extension points in my plugin.xml file, and added a query.xml file for the query, but this doesnt seem to work.
My code:
MyFirstQuery.java:
package my_mat_extension;
import org.eclipse.mat.query.IQuery;
import org.eclipse.mat.query.IResult;
import org.eclipse.mat.query.annotations.Argument;
import org.eclipse.mat.query.annotations.CommandName;
import org.eclipse.mat.query.results.TextResult;
import org.eclipse.mat.util.IProgressListener;
import java.io.CharArrayWriter;
import java.io.PrintWriter;
@CommandName("my_first_query")
public class MyFirstQuery implements IQuery {
@Override
public IResult execute(IProgressListener listener) throws Exception {
CharArrayWriter outWriter = new CharArrayWriter(1000);
PrintWriter out = new PrintWriter(outWriter);
out.println("My first query.");
return new TextResult(outWriter.toString(), false);
}
}
plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.mat.report.query">
<query impl="my_mat_extension.MyFirstQuery" />
</extension>
<extension point="org.eclipse.mat.report.report">
<report id="my_first_query" name="My First Query"
description="My First Description"
file="META-INF/reports/my_first_query.xml" />
</extension>
</plugin>
META-INF/reports/my_first_query.xml (link spaces necessary to post this thread):
<query name="My First Query" xmlns:xsi="h t t p : / / w w w .w3.org/2001/XMLSchema-instance"
xmlns="h t t p : / / w w w .eclipse.org/mat/report.xsd"
xsi:schemaLocation="h t t p : / / w w w .eclipse.org/mat/report.xsd ../../../org.eclipse.mat.report/schema/report.xsd">
<param key="filename_suffix" value="My First Query" />
<command>my_first_query</command>
</query>
Thanks for any help, and please ask if there is any more information you need!
Regards,
Stephen
[Updated on: Sat, 30 June 2012 02:53] Report message to a moderator
|
|
|
|
|
|
Re: Cannot get extension report to be found. [message #894623 is a reply to message #893187] |
Mon, 09 July 2012 20:45 |
Stephen McGruer Messages: 4 Registered: June 2012 |
Junior Member |
|
|
Apologies for the delay! I've now had a chance to look at the added section. It looks good, it's certainly nice to have a little bit on reports. When I have time, I might take a run through those documents and see if I can tidy it up.
Can I ask, is there any plans to expose a fully functional programmatic interface to MAT? That is, at the moment the only way to get at MAT functionality programmatically (and please correct me if I'm wrong!) to generate output for another program is to use the reports framework. However, reports seem to be deeply hardcoded (again as far as I know!) to generate a HTML file inside of a Zipped folder, located in exactly the same place as the heap dump.
Ideally, I'd be able to call one of the queries (or do the same actions as it, as I know that queries are not part of the API) programmatically from some code not relying on OSGI, or at least dump the results of a query out to a file/etc without worrying about this generated HTML & Zip folder.
Thanks,
Stephen
EDIT/UPDATE: So, I realized that using an IApplication might be slightly better, as it avoids the HTML/Zip problem while still allowing access to MAT internals. Is this the best approach then?
[Updated on: Tue, 10 July 2012 01:12] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.37316 seconds