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