mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
08.12.2007 5064c8626efa1e9d351f05792f9ccc403ec2eac0
Add some UI to be able to let the user choose whether to enable Windows Service or not.

This decision was taken in an admin meeting and the main reasons are that there are lots of users that may dislike the idea of OpenDS modifying the Windows Service Registry as they are not using it in production (yet).

Moreover there is a bug (1603) that prevents registering the server as a service on Vista, so these modifications will allow to the users to use the graphical setup on that OS.
7 files modified
114 ■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/UserData.java 24 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 4 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java 75 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties 3 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java 4 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/UserData.java
@@ -69,6 +69,8 @@
  private boolean stopServer;
  private boolean enableWindowsService;
  private NewSuffixOptions newSuffixOptions;
  private DataReplicationOptions replicationOptions;
@@ -88,6 +90,7 @@
   */
  public UserData() {
    startServer = true;
    enableWindowsService = false;
    NewSuffixOptions defaultNewSuffixOptions = new NewSuffixOptions(
        NewSuffixOptions.Type.CREATE_BASE_ENTRY, "dc=example,dc=com");
@@ -277,6 +280,27 @@
  }
  /**
   * Returns <CODE>true</CODE> if the windows service must be enabled during
   * installation, <CODE>false</CODE> if not.
   * @return <CODE>true</CODE> if the windows service must be enabled during
   * installation, <CODE>false</CODE> if not.
   */
  public boolean getEnableWindowsService()
  {
    return enableWindowsService;
  }
  /**
   * Sets whether we want to enable windows service during installation or not.
   * @param enableWindowsService the boolean indicating whether we want to
   * enable windows service during installation or not.
   */
  public void setEnableWindowsService(boolean enableWindowsService)
  {
    this.enableWindowsService = enableWindowsService;
  }
  /**
   * Returns the NewSuffixOptions object representing the data in the New Suffix
   * Data Options panel.
   * @return the NewSuffixOptions object representing the data in the New Suffix
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -3176,7 +3176,9 @@
  private void updateUserDataForReviewPanel(QuickSetup qs)
  {
    Boolean b = (Boolean) qs.getFieldValue(FieldName.SERVER_START);
    getUserData().setStartServer(b.booleanValue());
    getUserData().setStartServer(b);
    b = (Boolean) qs.getFieldValue(FieldName.ENABLE_WINDOWS_SERVICE);
    getUserData().setEnableWindowsService(b);
  }
  /**
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -90,7 +90,7 @@
      writeJavaHome();
      if (Utils.isWindows())
      if (Utils.isWindows() && getUserData().getEnableWindowsService())
      {
          notifyListeners(getTaskSeparator());
          setStatus(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
@@ -34,6 +34,7 @@
import org.opends.quicksetup.installer.NewSuffixOptions;
import org.opends.quicksetup.installer.SuffixesToReplicateOptions;
import org.opends.quicksetup.ui.*;
import org.opends.quicksetup.util.Utils;
import javax.swing.*;
import javax.swing.text.JTextComponent;
@@ -61,7 +62,8 @@
  private HashMap<FieldName, JTextComponent> hmFields =
      new HashMap<FieldName, JTextComponent>();
  private JPanel bottomComponent;
  private JCheckBox checkBox;
  private JCheckBox startCheckBox;
  private JCheckBox enableWindowsServiceCheckBox;
  private JLabel warningLabel;
  /**
@@ -85,6 +87,8 @@
    {
      setFieldValue(FieldName.SERVER_LOCATION, userData.getServerLocation());
    }
    setFieldValue(FieldName.HOST_NAME,
        String.valueOf(userData.getHostName()));
    setFieldValue(FieldName.SERVER_PORT,
        String.valueOf(userData.getServerPort()));
    setFieldValue(FieldName.SECURITY_OPTIONS,
@@ -129,7 +133,11 @@
    Object value = null;
    if (fieldName == FieldName.SERVER_START)
    {
      value = getCheckBox().isSelected();
      value = getStartCheckBox().isSelected();
    }
    else if (fieldName == FieldName.ENABLE_WINDOWS_SERVICE)
    {
      value = getEnableWindowsServiceCheckBox().isSelected();
    }
    return value;
  }
@@ -166,6 +174,11 @@
          LabelFieldDescriptor.LabelType.PRIMARY, 0));
    }
    hm.put(FieldName.HOST_NAME, new LabelFieldDescriptor(
        getMsg("host-name-label"), getMsg("host-name-tooltip"),
        LabelFieldDescriptor.FieldType.READ_ONLY,
        LabelFieldDescriptor.LabelType.PRIMARY, 0));
    hm.put(FieldName.SERVER_PORT, new LabelFieldDescriptor(
        getMsg("server-port-label"), getMsg("server-port-tooltip"),
        LabelFieldDescriptor.FieldType.READ_ONLY,
@@ -377,10 +390,10 @@
      fieldNames =
        new FieldName[]
          {
            FieldName.SERVER_LOCATION, FieldName.SERVER_PORT,
            FieldName.SECURITY_OPTIONS, FieldName.DIRECTORY_MANAGER_DN,
            FieldName.GLOBAL_ADMINISTRATOR_UID, FieldName.DATA_OPTIONS,
            FieldName.REPLICATION_PORT
            FieldName.SERVER_LOCATION, FieldName.HOST_NAME,
            FieldName.SERVER_PORT, FieldName.SECURITY_OPTIONS,
            FieldName.DIRECTORY_MANAGER_DN, FieldName.GLOBAL_ADMINISTRATOR_UID,
            FieldName.DATA_OPTIONS, FieldName.REPLICATION_PORT
          };
    }
    else
@@ -388,9 +401,10 @@
      fieldNames =
        new FieldName[]
          {
            FieldName.SERVER_PORT, FieldName.SECURITY_OPTIONS,
            FieldName.DIRECTORY_MANAGER_DN, FieldName.GLOBAL_ADMINISTRATOR_UID,
            FieldName.DATA_OPTIONS, FieldName.REPLICATION_PORT
            FieldName.HOST_NAME, FieldName.SERVER_PORT,
            FieldName.SECURITY_OPTIONS, FieldName.DIRECTORY_MANAGER_DN,
            FieldName.GLOBAL_ADMINISTRATOR_UID, FieldName.DATA_OPTIONS,
            FieldName.REPLICATION_PORT
          };
    }
@@ -437,15 +451,23 @@
    {
      bottomComponent = new JPanel(new GridBagLayout());
      GridBagConstraints gbc = new GridBagConstraints();
      gbc.anchor = GridBagConstraints.WEST;
      JPanel auxPanel = new JPanel(new GridBagLayout());
      gbc.gridwidth = 3;
      bottomComponent.add(getCheckBox(), gbc);
      auxPanel.add(getStartCheckBox(), gbc);
      gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
      gbc.gridwidth = GridBagConstraints.RELATIVE;
      bottomComponent.add(getWarningLabel(), gbc);
      auxPanel.add(getWarningLabel(), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      gbc.insets.left = 0;
      gbc.weightx = 1.0;
      bottomComponent.add(Box.createHorizontalGlue(), gbc);
      auxPanel.add(Box.createHorizontalGlue(), gbc);
      bottomComponent.add(auxPanel, gbc);
      if (Utils.isWindows())
      {
        gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
        bottomComponent.add(getEnableWindowsServiceCheckBox(), gbc);
      }
    }
    return bottomComponent;
  }
@@ -461,15 +483,16 @@
    return warningLabel;
  }
  private JCheckBox getCheckBox()
  private JCheckBox getStartCheckBox()
  {
    if (checkBox == null)
    if (startCheckBox == null)
    {
      checkBox =
      startCheckBox =
          UIFactory.makeJCheckBox(getMsg("start-server-label"),
              getMsg("start-server-tooltip"), UIFactory.TextStyle.CHECKBOX);
      checkBox.setSelected(getApplication().getUserData().getStartServer());
      checkBox.addActionListener(new ActionListener()
      startCheckBox.setSelected(
          getApplication().getUserData().getStartServer());
      startCheckBox.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent ev)
        {
@@ -477,7 +500,21 @@
        }
      });
    }
    return checkBox;
    return startCheckBox;
  }
  private JCheckBox getEnableWindowsServiceCheckBox()
  {
    if (enableWindowsServiceCheckBox == null)
    {
      enableWindowsServiceCheckBox =
          UIFactory.makeJCheckBox(getMsg("enable-windows-service-label"),
              getMsg("enable-windows-service-tooltip"),
              UIFactory.TextStyle.CHECKBOX);
      enableWindowsServiceCheckBox.setSelected(
          getApplication().getUserData().getEnableWindowsService());
    }
    return enableWindowsServiceCheckBox;
  }
  /**
@@ -486,7 +523,7 @@
   */
  private void checkStartWarningLabel()
  {
    boolean visible = !getCheckBox().isSelected();
    boolean visible = !getStartCheckBox().isSelected();
    if (visible)
    {
      UserData userData = getApplication().getUserData();
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -139,7 +139,7 @@
      configureServer();
      createData();
      if (Utils.isWindows())
      if (Utils.isWindows() && getUserData().getEnableWindowsService())
      {
          notifyListeners(getTaskSeparator());
          setStatus(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -835,6 +835,9 @@
start-server-label=Start Server when Configuration has Completed
start-server-tooltip=Check this check box if you want to start the server once \
the installation and configuration has completed
enable-windows-service-label=Run OpenDS as a Windows Service
enable-windows-service-tooltip=Check this check box if you want OpenDS to run \
as a Windows Service.
remote-server-replication-port={0} - To be configured on remote server {1}
install-server-must-be-temporarily-started=The Server will be temporarily \
started.
opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
@@ -146,6 +146,10 @@
  /**
   * The value associated with this is a Boolean.
   */
  ENABLE_WINDOWS_SERVICE,
  /**
   * The value associated with this is a Boolean.
   */
  REMOVE_LIBRARIES_AND_TOOLS,
  /**
   * The value associated with this is a Boolean.