1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.netbeans.modules.j2ee.deployment.profiler.spi; 21 22 import java.util.Map; 23 import javax.enterprise.deploy.spi.status.ProgressObject; 24 import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings; 25 26 /** 27 * Profiler has to implement this interface and register it in the default Lookup. 28 * 29 * @author sherold 30 */ 31 public interface Profiler { 32 33 /** 34 * Inform the profiler that some server is starting in the profile mode. It 35 * allows the Profiler to correctly detect STATE_STARTING. 36 */ 37 void notifyStarting(); 38 39 /** 40 * This method is used from the <code>nbstartprofiledserver</code> 41 * task to connect the Profiler to a server ready for profiling. 42 * 43 * @param projectProperties properties of project the <code>nbstartprofiledserver</code> 44 * ant task was started from. 45 * 46 * @return <code>true</code> if the Profiler successfully attached to the server. 47 */ 48 boolean attachProfiler(Map projectProperties); 49 50 /** 51 * This method is used from the Runtime tab to obtain settings for starting 52 * the server. It displays dialog and let the user choose required mode 53 * (direct/dynamic attach) and other settings for the server startup. 54 * 55 * @param serverInstanceID ID of the server instance that is going to be started 56 * 57 * @return required settings or <code>null</code> if user cancelled starting 58 * the server. 59 */ 60 ProfilerServerSettings getSettings(String serverInstanceID); 61 62 /** 63 * Returns state of Profiler agent instance started from the IDE. It detects 64 * possible response from an unknown (not started from the IDE) Profiler 65 * agent, in this case it returns STATE_INACTIVE. 66 * 67 * @return state of Profiler agent instance. 68 */ 69 int getState(); 70 71 /** 72 * Stops execution of the application (its JVM) currently being profiled. 73 * Shutdown is performed by the Profiler agent when in STATE_BLOCKED, STATE_RUNNING 74 * or STATE_PROFILING state. 75 * 76 * @return object used to monitor progress of shutdown. 77 */ 78 ProgressObject shutdown(); 79 } 80