From 06ec8c88556b02782c7b91a233de91eaf4a1439d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 09 Jun 2009 12:28:05 +0000
Subject: [PATCH] Fix for issue 3550 (Consider making the control panel able to manage remote servers)

---
 opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java |   79 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 73 insertions(+), 6 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java b/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
index 16f4612..7f2dfbd 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
@@ -83,18 +83,22 @@
 
   private boolean isAuthenticated;
 
-  private static String hostName = "locahost";
+  private static String localHostName = "locahost";
   static
   {
     try
     {
-      hostName = java.net.InetAddress.getLocalHost().getHostName();
+      localHostName = java.net.InetAddress.getLocalHost().getHostName();
     }
     catch (Throwable t)
     {
     }
   };
 
+  private String hostName = localHostName;
+
+  private boolean isLocal = true;
+
   /**
    * Enumeration indicating the status of the server.
    *
@@ -118,6 +122,10 @@
      */
     STOPPING,
     /**
+     * Not connected to remote.
+     */
+    NOT_CONNECTED_TO_REMOTE,
+    /**
      * Status Unknown.
      */
     UNKNOWN
@@ -295,6 +303,11 @@
 
         if (equals)
         {
+          equals = desc.isLocal() == isLocal();
+        }
+
+        if (equals)
+        {
           equals = desc.isAuthenticated() == isAuthenticated();
         }
 
@@ -305,12 +318,26 @@
 
         if (equals)
         {
-          equals = desc.getInstallPath().equals(getInstallPath());
+          if (desc.getInstallPath() == null)
+          {
+            equals = getInstallPath() == null;
+          }
+          else
+          {
+            equals = desc.getInstallPath().equals(getInstallPath());
+          }
         }
 
         if (equals)
         {
-          equals = desc.getInstancePath().equals(getInstancePath());
+          if (desc.getInstancePath() == null)
+          {
+            equals = getInstancePath() == null;
+          }
+          else
+          {
+            equals = desc.getInstancePath().equals(getInstancePath());
+          }
         }
 
         if (equals)
@@ -327,7 +354,14 @@
 
         if (equals)
         {
-          equals = desc.getOpenDSVersion().equals(getOpenDSVersion());
+          if (desc.getOpenDSVersion() == null)
+          {
+            equals = getOpenDSVersion() == null;
+          }
+          else
+          {
+            equals = desc.getOpenDSVersion().equals(getOpenDSVersion());
+          }
         }
 
         if (equals)
@@ -484,6 +518,37 @@
   }
 
   /**
+   * Sets the host name of the server.
+   * @param hostName the host name of the server.
+   */
+  public void setHostname(String hostName)
+  {
+    this.hostName = hostName;
+  }
+
+  /**
+   * Returns <CODE>true</CODE> if we are trying to manage the local host and
+   * <CODE>false</CODE> otherwise.
+   * @return <CODE>true</CODE> if we are trying to manage the local host and
+   * <CODE>false</CODE> otherwise.
+   */
+  public boolean isLocal()
+  {
+    return isLocal;
+  }
+
+  /**
+   * Sets whether this server represents the local instance or a remote server.
+   * @param isLocal whether this server represents the local instance or a
+   * remote server (in another machine or in another installation on the same
+   * machine).
+   */
+  public void setIsLocal(boolean isLocal)
+  {
+    this.isLocal = isLocal;
+  }
+
+  /**
    * Returns the exceptions that occurred while reading the configuration.
    * @return the exceptions that occurred while reading the configuration.
    */
@@ -772,7 +837,9 @@
   public void setAdminConnector(ConnectionHandlerDescriptor adminConnector)
   {
     this.adminConnector = adminConnector;
-  }/**
+  }
+
+  /**
    * Sets the monitoring entry for the entry caches.
    * @param entryCaches the monitoring entry for the entry caches.
    */

--
Gitblit v1.10.0