Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.

1 /*2 * The contents of this file are subject to the terms of the Common Development3 * and Distribution License (the License). You may not use this file except in4 * compliance with the License.5 *6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html7 * or http://www.netbeans.org/cddl.txt.8 *9 * When distributing Covered Code, include this CDDL Header Notice in each file10 * and include the License file at http://www.netbeans.org/cddl.txt.11 * If applicable, add the following below the CDDL Header, with the fields12 * 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 Original16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun17 * Microsystems, Inc. All Rights Reserved.18 */19 20 21 package org.netbeans.modules.j2ee.deployment.plugins.api;22 23 importjavax.enterprise.deploy.spi.Target;24 importjavax.enterprise.deploy.spi.status.ProgressObject;25 importorg.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;26 27 /**28 * Server lifecycle services from the IDE. J2eeserver will use these29 * services to automatically start or stop admin server and managed (virtual)30 * target servers (in debug mode) during deployment or debugging execution.31 *32 * @see OptionalDeploymentManagerFactory33 * @author George FinKlang34 * @author nn13668235 * @version 1.036 */37 publicabstractclass StartServer {38 39 /**40 * Returns true if the admin server is also the given target server (share the same vm).41 * Start/stopping/debug apply to both servers. When the given target server is null,42 * service should return true when admin server is also some target.43 * @param target the target server in question; could be null.44 * @return true when admin is also target server45 */46 publicabstractboolean isAlsoTargetServer(Target target);47 48 /**49 * Returns true if the admin server can be started through this spi.50 */51 publicabstractboolean supportsStartDeploymentManager();52 53 /**54 * Returns if the plugin can start/stop single target servers.55 * This should be overwritten as needed.56 * @param target the target server in question, could be null in which57 * case the answer should probably be false.58 * @return true if this plugin can currently handle state management for 59 * the specific target.60 * @since 1.661 */62 publicboolean supportsStartTarget(Target target) {63 returnfalse;64 }65 66 /**67 * Can be the specified target server started in the debug mode? If the 68 * target is also an admin server can be the admin server started in the69 * debug mode?70 *71 * @param target the target server in question, null implies the case where 72 * target is also an admin server.73 *74 * @return true if the target server can be started in the debug mode, false75 * otherwise. The default return value is false.76 *77 * @since 1.778 */79 publicboolean supportsStartDebugging(Target target) {80 returnfalse;81 }82 83 /**84 * Can be the specified target server started in profile mode? If the 85 * target is also an admin server can be the admin server started in86 * profile mode?87 *88 * @param target the target server in question, null implies the case where 89 * target is also an admin server.90 *91 * @return true if the target server can be started in profile mode, false92 * otherwise. The default return value is false.93 *94 * @since 1.995 */96 publicboolean supportsStartProfiling(Target target) {97 returnfalse;98 }99 100 /**101 * Starts the admin server. Note that this means that the DeploymentManager102 * was originally created disconnected. After calling this, the DeploymentManager103 * will be connected, so any old cached DeploymentManager will be discarded.104 * All diagnostics should be communicated through ProgressObject without exceptions thrown.105 *106 * @return ProgressObject object used to monitor start server progress107 */108 publicabstractProgressObject startDeploymentManager();109 110 /**111 * Stops the admin server. The DeploymentManager object will be disconnected.112 * All diagnostic should be communicated through ServerProgres with no113 * exceptions thrown.114 * @return ServerProgress object used to monitor start server progress115 */116 publicabstractProgressObject stopDeploymentManager();117 118 /** Optional method. This implementation does nothing.119 *120 * Stops the admin server. The DeploymentManager object will be disconnected.121 * The call should terminate immediately and not wait for the server to stop.122 * <div class="nonnormative">123 * This will be used at IDE shutdown so that the server shutdown does not block the IDE.124 * </div>125 */126 publicvoid stopDeploymentManagerSilently() {127 //do nothing128 }129 130 /** See {@link stopDeploymentManagerSilently}131 * @return override and return true if stopDeploymentManagerSilently is implemented132 */133 publicboolean canStopDeploymentManagerSilently () {134 returnfalse; 135 }136 137 /**138 * Returns true if the admin server should be started before server deployment configuration.139 */140 publicabstractboolean needsStartForConfigure();141 142 /**143 * Returns true if the admin server should be started before asking for144 * target list.145 */146 publicabstractboolean needsStartForTargetList();147 148 /**149 * Returns true if the admin server should be started before admininistrative configuration.150 */151 publicabstractboolean needsStartForAdminConfig();152 153 /**154 * Returns true if this admin server is running.155 */156 publicabstractboolean isRunning();157 158 /**159 * Returns the running state of a specific target. This should be160 * overwritten by plugins which support multiple target servers via161 * one admin server.162 * @param target the target server in question; null value implies 163 * the query is against the admin server.164 * @return true if the server is question is running.165 * @since 1.6166 */167 publicboolean isRunning(Target target) {168 if (target == null || isAlsoTargetServer(target)) {169 return isRunning();170 }171 172 returnfalse;173 }174 175 /**176 * Returns true if the given target is in debug mode.177 */178 publicabstractboolean isDebuggable(Target target);179 180 /**181 * Starts the target server asynchronously and reports the status182 * through the returned <code>ProgressObject</code>. This should be183 * overwritten by plugins which support the state management of184 * different target servers.185 * @param target a non-null target server to be started186 * @return a ProgressObject which is used to communicate the187 * progess/state of this action. Should not be null when supportsStartTarget 188 * returns true on same target.189 * @since 1.6190 */191 publicProgressObject startTarget(Target target) {192 returnnull;193 }194 195 /**196 * Stops the target server asynchronously and reports the status197 * through the returned <code>ProgressObject</code>. This should be198 * overwritten by plugins which support the state management of199 * different target servers.200 * @param target a non-null target server to be stopped201 * @return a ProgressObject which is used to communicate the202 * progess/state of this action. Should not be null when supportsStartTarget 203 * return true on the same target.204 * @since 1.6205 */206 publicProgressObject stopTarget(Target target) {207 returnnull;208 }209 210 /**211 * Start or restart the target in debug mode.212 * If target is also domain admin, the amdin is restarted in debug mode.213 * All diagnostic should be communicated through ServerProgres with no exceptions thrown.214 * @param target the target server215 * @return ServerProgress object to monitor progress on start operation216 */217 publicabstractProgressObject startDebugging(Target target);218 219 /**220 * Start the target in profile mode, null target implies the admin server.221 *222 * @param target the target server in question, null target implies 223 * the admin server.224 * @param settings profiler server settings.225 *226 * @return ServerProgress object to monitor progress on start operation.227 *228 * @since 1.9229 */230 publicProgressObject startProfiling(Target target, ProfilerServerSettings settings) {231 thrownewUnsupportedOperationException("Starting in profile mode is not supported by this server."); // NIO18N232 }233 234 /**235 * Returns the host/port necessary for connecting to the server's debug information.236 */237 publicabstractServerDebugInfo getDebugInfo(Target target);238 239 /**240 * Returns true if target server needs a restart for last configuration changes to 241 * take effect. Implementation should override when communication about this 242 * server state is needed.243 *244 * @param target target server; null implies the case where target is also admin server.245 */246 publicboolean needsRestart(Target target) {247 returnfalse;248 }249 }250