Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 229449 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mat/snapshot/acquire/IHeapDumpProvider.java (+50 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 SAP AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    SAP AG - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mat.snapshot.acquire;
12
13
import java.io.File;
14
import java.util.List;
15
16
import org.eclipse.mat.util.IProgressListener;
17
18
/**
19
 * Provides functionality to acquire a heap dump from a locally running Java process
20
 * 
21
 * @author ktsvetkov
22
 *
23
 */
24
public interface IHeapDumpProvider
25
{
26
	/**
27
	 * Returns a list of locally running Java processes from which the heap dump
28
	 * provider can attempt to acquire a heap dump
29
	 * 
30
	 * @return List<VmInfo> the list of processes ({@link VmInfo})
31
	 */
32
	public List<VmInfo> getAvailableVMs();
33
34
	/**
35
	 * Acquire a heap dump from a locally running Java process. The
36
	 * 
37
	 * @param info
38
	 *            a descriptor of the Java process which should be dumped
39
	 * @param preferredLocation
40
	 *            a preferred filename under which the heap dump should be
41
	 *            saved. The {@link IHeapDumpProvider} is not obliged to provide
42
	 *            the heap dump at this location
43
	 * @param listener
44
	 *            a progress listener
45
	 * @return the File under which the successfully generated heap dump is
46
	 *         saved
47
	 * @throws Exception
48
	 */
49
	public File acquireDump(VmInfo info, File preferredLocation, IProgressListener listener) throws Exception;
50
}
(-)src/org/eclipse/mat/snapshot/acquire/VmInfo.java (+118 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 SAP AG.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    SAP AG - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mat.snapshot.acquire;
12
13
/**
14
 * Instances of this class are descriptors of locally running Java processes
15
 * 
16
 * @author ktsvetkov
17
 * 
18
 */
19
public final class VmInfo
20
{
21
	private int pid;
22
	private String description;
23
	private boolean heapDumpEnabled;
24
	private String proposedFileName;
25
26
	private IHeapDumpProvider heapDumpProvider;
27
28
	/**
29
	 * An empty constructor
30
	 */
31
	public VmInfo()
32
	{}
33
34
	/**
35
	 * Constructor with parameters
36
	 * 
37
	 * @param pid
38
	 *            the process ID of the process
39
	 * @param description
40
	 *            a free text description of the process, usually the process
41
	 *            name
42
	 * @param heapDumpEnabled
43
	 *            a boolean value indicating if a heap dump from the process can
44
	 *            be acquired
45
	 * @param proposedFileName
46
	 *            a proposal for the file name, under which the heap dump can be
47
	 *            saved. %pid% can be used as a placeholder for the PID.
48
	 *            Example: java_pid%pid%.hprof
49
	 * @param heapDumpProvider
50
	 *            the {@link IHeapDumpProvider} which can use this VmInfo
51
	 */
52
	public VmInfo(int pid, String description, boolean heapDumpEnabled, String proposedFileName, IHeapDumpProvider heapDumpProvider)
53
	{
54
		super();
55
		this.pid = pid;
56
		this.description = description;
57
		this.heapDumpEnabled = heapDumpEnabled;
58
		this.proposedFileName = proposedFileName;
59
		this.heapDumpProvider = heapDumpProvider;
60
	}
61
62
	public int getPid()
63
	{
64
		return pid;
65
	}
66
67
	public void setPid(int pid)
68
	{
69
		this.pid = pid;
70
	}
71
72
	public String getDescription()
73
	{
74
		return description;
75
	}
76
77
	public void setDescription(String description)
78
	{
79
		this.description = description;
80
	}
81
82
	public boolean isHeapDumpEnabled()
83
	{
84
		return heapDumpEnabled;
85
	}
86
87
	public void setHeapDumpEnabled(boolean heapDumpEnabled)
88
	{
89
		this.heapDumpEnabled = heapDumpEnabled;
90
	}
91
92
	public IHeapDumpProvider getHeapDumpProvider()
93
	{
94
		return heapDumpProvider;
95
	}
96
97
	public void setHeapDumpProvider(IHeapDumpProvider heapDumpProvider)
98
	{
99
		this.heapDumpProvider = heapDumpProvider;
100
	}
101
102
	public String getProposedFileName()
103
	{
104
		return proposedFileName;
105
	}
106
107
	public void setProposedFileName(String proposedFileName)
108
	{
109
		this.proposedFileName = proposedFileName;
110
	}
111
112
	@Override
113
	public String toString()
114
	{
115
		return "PID = " + pid + "\t" + description;
116
	}
117
118
}
(-)schema/heapDumpProvider.exsd (+102 lines)
Line 0 Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.mat.api" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.mat.api" id="heapDumpProvider" name="Heap Dump Provider"/>
7
      </appInfo>
8
      <documentation>
9
         [Enter description of this extension point.]
10
      </documentation>
11
   </annotation>
12
13
   <element name="extension">
14
      <annotation>
15
         <appInfo>
16
            <meta.element />
17
         </appInfo>
18
      </annotation>
19
      <complexType>
20
         <sequence minOccurs="0" maxOccurs="unbounded">
21
            <element ref="provider"/>
22
         </sequence>
23
         <attribute name="point" type="string" use="required">
24
            <annotation>
25
               <documentation>
26
                  
27
               </documentation>
28
            </annotation>
29
         </attribute>
30
         <attribute name="id" type="string">
31
            <annotation>
32
               <documentation>
33
                  
34
               </documentation>
35
            </annotation>
36
         </attribute>
37
         <attribute name="name" type="string">
38
            <annotation>
39
               <documentation>
40
                  
41
               </documentation>
42
               <appInfo>
43
                  <meta.attribute translatable="true"/>
44
               </appInfo>
45
            </annotation>
46
         </attribute>
47
      </complexType>
48
   </element>
49
50
   <element name="provider">
51
      <complexType>
52
         <attribute name="impl" type="string">
53
            <annotation>
54
               <documentation>
55
                  
56
               </documentation>
57
               <appInfo>
58
                  <meta.attribute kind="java" basedOn=":org.eclipse.mat.snapshot.acquire.IHeapDumpProvider"/>
59
               </appInfo>
60
            </annotation>
61
         </attribute>
62
      </complexType>
63
   </element>
64
65
   <annotation>
66
      <appInfo>
67
         <meta.section type="since"/>
68
      </appInfo>
69
      <documentation>
70
         [Enter the first release in which this extension point appears.]
71
      </documentation>
72
   </annotation>
73
74
   <annotation>
75
      <appInfo>
76
         <meta.section type="examples"/>
77
      </appInfo>
78
      <documentation>
79
         [Enter extension point usage example here.]
80
      </documentation>
81
   </annotation>
82
83
   <annotation>
84
      <appInfo>
85
         <meta.section type="apiinfo"/>
86
      </appInfo>
87
      <documentation>
88
         [Enter API information here.]
89
      </documentation>
90
   </annotation>
91
92
   <annotation>
93
      <appInfo>
94
         <meta.section type="implementation"/>
95
      </appInfo>
96
      <documentation>
97
         [Enter information about supplied implementation of this extension point.]
98
      </documentation>
99
   </annotation>
100
101
102
</schema>
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 12-18 Link Here
12
 org.eclipse.mat.snapshot.inspections,
12
 org.eclipse.mat.snapshot.inspections,
13
 org.eclipse.mat.snapshot.model,
13
 org.eclipse.mat.snapshot.model,
14
 org.eclipse.mat.snapshot.query,
14
 org.eclipse.mat.snapshot.query,
15
 org.eclipse.mat.snapshot.registry
15
 org.eclipse.mat.snapshot.registry,
16
 org.eclipse.mat.snapshot.acquire
16
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.3.100",
17
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.3.100",
17
 org.eclipse.mat.report;bundle-version="0.8.0";visibility:=reexport
18
 org.eclipse.mat.report;bundle-version="0.8.0";visibility:=reexport
18
Bundle-Activator: org.eclipse.mat.internal.MATPlugin
19
Bundle-Activator: org.eclipse.mat.internal.MATPlugin
(-)plugin.xml (+1 lines)
Lines 7-12 Link Here
7
	<extension-point id="threadResolver" name="Thread Details Resolver" schema="schema/threadResolver.exsd"/>
7
	<extension-point id="threadResolver" name="Thread Details Resolver" schema="schema/threadResolver.exsd"/>
8
	<extension-point id="requestResolver" name="Request Details Resolver" schema="schema/requestResolver.exsd"/>
8
	<extension-point id="requestResolver" name="Request Details Resolver" schema="schema/requestResolver.exsd"/>
9
	<extension-point id="ticketResolver" name="Trouble Ticket Resolver" schema="schema/ticketResolver.exsd"/>
9
	<extension-point id="ticketResolver" name="Trouble Ticket Resolver" schema="schema/ticketResolver.exsd"/>
10
 <extension-point id="heapDumpProvider" name="Heap Dump Provider" schema="schema/heapDumpProvider.exsd"/>
10
	
11
	
11
	<extension point="org.eclipse.mat.report.query">
12
	<extension point="org.eclipse.mat.report.query">
12
		<!-- public -->
13
		<!-- public -->

Return to bug 229449