IRuntime.java revision f9843446d68ccdbab7fb4006b381b1f8abfbf091
1/******************************************************************************* 2 * Copyright (c) 2009, 2010 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 * Marc R. Hoffmann - initial API and implementation 10 * 11 * $Id: $ 12 *******************************************************************************/ 13package org.jacoco.core.runtime; 14 15import org.jacoco.core.data.IExecutionDataVisitor; 16 17/** 18 * This interface represents a particular mechanism to collect execution 19 * information in the target VM at runtime. 20 * 21 * @author Marc R. Hoffmann 22 * @version $Revision: $ 23 */ 24public interface IRuntime extends IExecutionDataAccessorGenerator { 25 26 /** 27 * Starts the coverage runtime. This method MUST be called before any class 28 * instrumented for this runtime is loaded. 29 * 30 * @throws Exception 31 * any internal problem during startup 32 */ 33 public void startup() throws Exception; 34 35 /** 36 * Allows the coverage runtime to cleanup internals. This class should be 37 * called when classes instrumented for this runtime are not used any more. 38 */ 39 public void shutdown(); 40 41 /** 42 * Before a particular class gets loaded, its execution data structure must 43 * be registered with the runtime through this method. This method must only 44 * be called between {@link #startup()} and {@link #shutdown()}. 45 * 46 * @param classid 47 * identifier of the class 48 * @param name 49 * VM name of the class 50 * @param data 51 * execution data structure for this class 52 */ 53 public void registerClass(long classid, final String name, boolean[] data); 54 55 /** 56 * Collects the current execution data and writes it to the given 57 * {@link IExecutionDataVisitor} object. This method must only be called 58 * between {@link #startup()} and {@link #shutdown()}. 59 * 60 * @param visitor 61 * handler to write coverage data to 62 * @param reset 63 * if <code>true</code> the current coverage information is also 64 * cleared 65 */ 66 public void collect(IExecutionDataVisitor visitor, boolean reset); 67 68 /** 69 * Resets all coverage information. This method must only be called between 70 * {@link #startup()} and {@link #shutdown()}. 71 */ 72 public void reset(); 73 74} 75