StatusPanelController.java revision 3bd997f0d659b0b5280791733d0101a588b01da5
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * CDDL HEADER START
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The contents of this file are subject to the terms of the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Common Development and Distribution License, Version 1.0 only
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * (the "License"). You may not use this file except in compliance
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * with the License.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * You can obtain a copy of the license at
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * trunk/opends/resource/legal-notices/OpenDS.LICENSE
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * See the License for the specific language governing permissions
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * and limitations under the License.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * When distributing Covered Code, include this CDDL HEADER in each
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * file and include the License file at
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * add the following below this CDDL HEADER, with the fields enclosed
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * by brackets "[]" replaced with your own identifying information:
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Portions Copyright [yyyy] [name of copyright owner]
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * CDDL HEADER END
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Portions Copyright 2006-2007 Sun Microsystems, Inc.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.opends.admin.ads.util.ApplicationTrustManager;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.opends.guitools.statuspanel.event.ServerStatusChangeEvent;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.opends.guitools.statuspanel.event.ServerStatusChangeListener;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.opends.guitools.statuspanel.event.StatusPanelButtonListener;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.opends.guitools.statuspanel.ui.LoginDialog;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.opends.guitools.statuspanel.ui.StatusPanelDialog;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.opends.quicksetup.util.BackgroundTask;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.opends.quicksetup.util.HtmlProgressMessageFormatter;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport static org.opends.messages.AdminToolMessages.*;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport static org.opends.messages.QuickSetupMessages.*;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * This is the main class of the status panel.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * It is in charge of all the logic behind the displaying of the dialogs and
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * the one that initializes everything. This is also the class that ultimately
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * listens to user events (notably button clicks) and executes the associated
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * operations with these user events.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkpublic class StatusPanelController implements ServerStatusChangeListener,
new HtmlProgressMessageFormatter();
private boolean isStarting;
private boolean isStopping;
private boolean isRestarting;
private boolean mustDisplayAuthenticateDialog;
public void display()
if (!isAuthenticated())
public void run()
public void quitClicked()
public void startClicked()
if (isStarting)
else if (isStopping)
else if (isRestarting)
isStarting = true;
return null;
if (t != null)
t.printStackTrace();
!isAuthenticated());
isStarting = false;
public void stopClicked()
if (isStopping)
else if (isStarting)
else if (isRestarting)
if (stopServer)
isStopping = true;
stopServer();
mustDisplayAuthenticateDialog = false;
return null;
if (t != null)
t.printStackTrace();
isStopping = false;
public void restartClicked()
if (isRestarting)
else if (isStopping)
else if (isStarting)
if (restartServer)
isRestarting = true;
if (stopServer())
!isAuthenticated();
mustDisplayAuthenticateDialog = false;
return null;
if (t != null)
t.printStackTrace();
!isAuthenticated());
isRestarting = false;
public void authenticateClicked()
private void initLookAndFeel()
return loginDialog;
mustDisplayAuthenticateDialog = false;
return progressDialog;
return controlPanelDialog;
protected boolean startServer()
boolean started = false;
if (isRestarting)
getTaskSeparator());
boolean running = false;
if (!running)
catch (Throwable t)
if (!running)
started = true;
msg);
msg);
msg);
return started;
private boolean stopServer()
boolean stopped = false;
int clientSideError =
.isServerRunning();
if (!stopped)
msg);
if (!stopped)
if (!isRestarting)
msg);
msg);
stopped = true;
msg);
if (!isRestarting)
msg);
msg);
stopped = true;
msg);
msg);
return stopped;
private void runProgressUpdater()
public void run()
public void run()
public void run()
} catch (Throwable t)
t.printStackTrace();
private class ProgressReader
private boolean isFirstLine;
final boolean isStart)
isFirstLine = true;
public void run()
if (!isFirstLine)
if (isError)
isFirstLine = false;
} catch (Throwable t)
t.start();
return errorMsg;
private boolean confirmStop()
private boolean confirmRestart()
private boolean isAuthenticated()