1/*******************************************************************************
2 * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
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 *    Evgeny Mandrikov - initial API and implementation
10 *
11 *******************************************************************************/
12package org.jacoco.agent.rt;
13
14import java.io.IOException;
15
16/**
17 * Runtime API and MBean agent interface.
18 */
19public interface IAgent {
20
21	/**
22	 * Returns version of JaCoCo.
23	 *
24	 * @return version of JaCoCo
25	 */
26	String getVersion();
27
28	/**
29	 * Returns current a session identifier.
30	 *
31	 * @return current session identifier
32	 */
33	String getSessionId();
34
35	/**
36	 * Sets a session identifier.
37	 *
38	 * @param id
39	 *            new session identifier
40	 */
41	void setSessionId(String id);
42
43	/**
44	 * Resets all coverage information.
45	 */
46	void reset();
47
48	/**
49	 * Returns current execution data.
50	 *
51	 * @param reset
52	 *            if <code>true</code> the current execution data is cleared
53	 *            afterwards
54	 * @return dump of current execution data in JaCoCo binary format
55	 */
56	byte[] getExecutionData(boolean reset);
57
58	/**
59	 * Triggers a dump of the current execution data through the configured
60	 * output.
61	 *
62	 * @param reset
63	 *            if <code>true</code> the current execution data is cleared
64	 *            afterwards
65	 * @throws IOException
66	 *             if the output can't write execution data
67	 */
68	void dump(boolean reset) throws IOException;
69
70}
71