[hornetq-commits] JBoss hornetq SVN: r8774 - in trunk: src/config/common/schema and 10 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jan 7 15:57:03 EST 2010


Author: timfox
Date: 2010-01-07 15:57:02 -0500 (Thu, 07 Jan 2010)
New Revision: 8774

Modified:
   trunk/docs/user-manual/en/clusters.xml
   trunk/docs/user-manual/en/configuration-index.xml
   trunk/docs/user-manual/en/management.xml
   trunk/src/config/common/schema/hornetq-configuration.xsd
   trunk/src/main/org/hornetq/core/config/Configuration.java
   trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
   trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
   trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
   trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
   trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
   trunk/src/main/org/hornetq/core/server/management/ManagementService.java
   trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
   trunk/tests/config/ConfigurationTest-full-config.xml
   trunk/tests/joram-tests/src/org/hornetq/jms/HornetQAdmin.java
   trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
   trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java
   trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java
   trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
Log:
moved cluster admin password out of management

Modified: trunk/docs/user-manual/en/clusters.xml
===================================================================
--- trunk/docs/user-manual/en/clusters.xml	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/docs/user-manual/en/clusters.xml	2010-01-07 20:57:02 UTC (rev 8774)
@@ -417,6 +417,20 @@
                 </listitem>
             </itemizedlist>
         </section>
+        <section id="clusters.clusteruser">
+            <title>Cluster User Credentials</title>
+            
+            <para>When creating connections between nodes of a cluster to form a cluster connection,
+                HornetQ uses a cluster user and cluster password which is defined in <literal>hornetq-configuration.xml</literal>:</para>
+            <programlisting>
+                &lt;management-cluster-user&gt;HORNETQ.CLUSTER.ADMIN.USER&lt;/management-cluster-user&gt;
+                &lt;management-cluster-password&gt;CHANGE ME!!&lt;/management-cluster-password&gt;
+            </programlisting>
+            <para>It is imperative that these values are changed from their default, or remote clients will be able to make connections
+                to the server using the default values. If they are not
+                changed from the default, HornetQ will detect this and pester you with a warning on every
+                start-up.</para>
+        </section>
     </section>
     <section id="clusters.client.loadbalancing">
         <title>Client-Side Load balancing</title>

Modified: trunk/docs/user-manual/en/configuration-index.xml
===================================================================
--- trunk/docs/user-manual/en/configuration-index.xml	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/docs/user-manual/en/configuration-index.xml	2010-01-07 20:57:02 UTC (rev 8774)
@@ -227,15 +227,15 @@
                         </row>
                         <row>
                             <entry><link linkend="management.replication"
-                                    >management-cluster-user</link></entry>
+                                    >cluster-user</link></entry>
                             <entry>String</entry>
                             <entry>the user used to for replicating management operations between
                                 clustered nodes</entry>
-                            <entry>HORNETQ.MANAGEMENT.ADMIN.USER</entry>
+                            <entry>HORNETQ.CLUSTER.ADMIN.USER</entry>
                         </row>
                         <row>
                             <entry><link linkend="management.replication"
-                                    >management-cluster-password</link></entry>
+                                    >cluster-password</link></entry>
                             <entry>String</entry>
                             <entry>the password used to for replicating management operations
                                 between clustered nodes</entry>

Modified: trunk/docs/user-manual/en/management.xml
===================================================================
--- trunk/docs/user-manual/en/management.xml	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/docs/user-manual/en/management.xml	2010-01-07 20:57:02 UTC (rev 8774)
@@ -216,7 +216,7 @@
                   <para>Retrieving the queue attributes</para>
                   <para>The <literal>QueueControl</literal> exposes Core queue settings through its
                      attributes (e.g. <literal>getFilter()</literal> to retrieve the queue's filter
-                     if it was created with one, <literal>isDurable()</literal> to know wether the
+                     if it was created with one, <literal>isDurable()</literal> to know whether the
                      queue is durable or not, etc.)</para>
                </listitem>
                <listitem>
@@ -376,9 +376,9 @@
                   <para>The <literal>ConnectionFactoryControl</literal> exposes JMS
                      ConnectionFactory configuration through its attributes (e.g. <literal
                         >getConsumerWindowSize()</literal> to retrieve the consumer window size for
-                     flow control, <literal>isBlockOnNonDurableSend()</literal> to know wether
-                     the producers created from the connection factory will block or not when
-                     sending non-durable messages, etc.)</para>
+                     flow control, <literal>isBlockOnNonDurableSend()</literal> to know wether the
+                     producers created from the connection factory will block or not when sending
+                     non-durable messages, etc.)</para>
                </listitem>
             </itemizedlist>
          </section>
@@ -587,9 +587,8 @@
       <para>A <literal>ClientConsumer</literal> can be used to consume the management reply and
          retrieve the result of the operation (if any) stored in the reply's body. For portability,
          results are returned as a <ulink url="http://json.org">JSON</ulink> String rather than Java
-         Serialization (the <literal
-            >org.hornetq.api.core.management.ManagementHelper</literal> can be used to
-         convert the JSON string to Java objects).</para>
+         Serialization (the <literal>org.hornetq.api.core.management.ManagementHelper</literal> can
+         be used to convert the JSON string to Java objects).</para>
       <para>These steps can be simplified to make it easier to invoke management operations using
          Core messages:</para>
       <orderedlist>
@@ -602,16 +601,16 @@
          </listitem>
          <listitem>
             <para>Use the helper class <literal
-                  >org.hornetq.api.core.management.ManagementHelper</literal> to fill the
-               message with the management properties</para>
+                  >org.hornetq.api.core.management.ManagementHelper</literal> to fill the message
+               with the management properties</para>
          </listitem>
          <listitem>
             <para>Send the message using the <literal>ClientRequestor</literal></para>
          </listitem>
          <listitem>
             <para>Use the helper class <literal
-                  >org.hornetq.api.core.management.ManagementHelper</literal> to retrieve
-               the operation result from the management reply</para>
+                  >org.hornetq.api.core.management.ManagementHelper</literal> to retrieve the
+               operation result from the management reply</para>
          </listitem>
       </orderedlist>
       <para>For example, to find out the number of messages in the core queue <literal
@@ -628,10 +627,10 @@
       <para>Management operation name and parameters must conform to the Java interfaces defined in
          the <literal>management</literal> packages.</para>
       <para>Names of the resources are built using the helper class <literal
-            >org.hornetq.api.core.management.ResourceNames</literal> and are straightforward (<literal
-            >core.queue.exampleQueue</literal> for the Core Queue <literal>exampleQueue</literal>,
-            <literal>jms.topic.exampleTopic</literal> for the JMS Topic <literal
-            >exampleTopic</literal>, etc.).</para>
+            >org.hornetq.api.core.management.ResourceNames</literal> and are straightforward
+            (<literal>core.queue.exampleQueue</literal> for the Core Queue <literal
+            >exampleQueue</literal>, <literal>jms.topic.exampleTopic</literal> for the JMS Topic
+            <literal>exampleTopic</literal>, etc.).</para>
       <section id="management.core.configuration">
          <title>Configuring Core Management</title>
          <para>The management address to send management messages is configured in <literal
@@ -639,8 +638,8 @@
          <programlisting>
    &lt;management-address&gt;jms.queue.hornetq.management&lt;/management-address&gt;
          </programlisting>
-         <para>By default, the address is <literal>jms.queue.hornetq.management</literal>
-         (it is prepended by "jms.queue" so that JMS clients can also send management messages).</para>
+         <para>By default, the address is <literal>jms.queue.hornetq.management</literal> (it is
+            prepended by "jms.queue" so that JMS clients can also send management messages).</para>
          <para>The management address requires a <emphasis>special</emphasis> user permission
                <literal>manage</literal> to be able to receive and handle management messages. This
             is also configured in hornetq-configuration.xml:</para>
@@ -675,16 +674,16 @@
          </listitem>
          <listitem>
             <para>use the helper class <literal
-                  >org.hornetq.api.jms.management.JMSManagementHelper</literal> to fill the
-               message with the management properties</para>
+                  >org.hornetq.api.jms.management.JMSManagementHelper</literal> to fill the message
+               with the management properties</para>
          </listitem>
          <listitem>
             <para>send the message using the <literal>QueueRequestor</literal></para>
          </listitem>
          <listitem>
             <para>use the helper class <literal
-                  >org.hornetq.api.jms.management.JMSManagementHelper</literal> to retrieve
-               the operation result from the management reply</para>
+                  >org.hornetq.api.jms.management.JMSManagementHelper</literal> to retrieve the
+               operation result from the management reply</para>
          </listitem>
       </orderedlist>
       <para>For example, to know the number of messages in the JMS queue <literal
@@ -712,33 +711,7 @@
             messages to manage HornetQ server.</para>
       </section>
    </section>
-   <section id="management.replication">
-      <title>Management Cluster Credentials</title>
-      <para>HornetQ allows <emphasis>replication</emphasis> of a live server to a backup server.
-         This impacts management as resources created on the live server (e.g. a core address) must
-         also be created on the backup server. Otherwise, when failover occurs, the backup server
-         will not be able to handle messages sent to this address since its resources will have been
-         created on the live server only and not on the backup.</para>
-      <para>HornetQ <emphasis>replicates management operations</emphasis> regardless of the
-         management API used (JMX, Core messages, JMS messages). Any management operation invoked on
-         a live server will also be invoked on its backup server to ensure a proper replication of
-         resources and state. For example, you only need to manage the live server: if a queue is
-         created on the live server, HornetQ will ensure that the same resource will also be created
-         on the backup server.</para>
-      <para>If core or JMS messages are used to invoke management operations, replication is handled
-         automatically by HornetQ.</para>
-      <para>To allow this management replication with JMX, HornetQ defines <emphasis>management
-            cluster credentials</emphasis>: this special user/password <emphasis>must be shared by
-            all nodes</emphasis>. To configure it, change the value in <literal
-            >hornetq-configuration.xml</literal>:</para>
-      <programlisting>
-   &lt;management-cluster-user&gt;HORNETQ.MANAGEMENT.ADMIN.USER&lt;/management-cluster-user&gt;
-   &lt;management-cluster-password&gt;CHANGE ME!!&lt;/management-cluster-password&gt;
-      </programlisting>
-      <para>It is strongly suggested to change these values from their default. If they are not
-         changed from the default, HornetQ will detect this and pester you with a warning on every
-         start-up.</para>
-   </section>
+ 
    <section id="management.notifications">
       <title>Management Notifications</title>
       <para>HornetQ emits <emphasis>notifications</emphasis> to inform listeners of potentially

Modified: trunk/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-configuration.xsd	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/config/common/schema/hornetq-configuration.xsd	2010-01-07 20:57:02 UTC (rev 8774)
@@ -31,9 +31,9 @@
 				</xsd:element>
 				<xsd:element maxOccurs="1" minOccurs="0" name="management-notification-address" type="xsd:string">
 				</xsd:element>
-                <xsd:element maxOccurs="1" minOccurs="0" name="management-cluster-user" type="xsd:string">
+                <xsd:element maxOccurs="1" minOccurs="0" name="cluster-user" type="xsd:string">
                 </xsd:element>				
-                <xsd:element maxOccurs="1" minOccurs="0" name="management-cluster-password" type="xsd:string">
+                <xsd:element maxOccurs="1" minOccurs="0" name="cluster-password" type="xsd:string">
                 </xsd:element>				
                 <xsd:element maxOccurs="1" minOccurs="0" name="log-delegate-factory-class-name" type="xsd:string">
                 </xsd:element>

Modified: trunk/src/main/org/hornetq/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/Configuration.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/main/org/hornetq/core/config/Configuration.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -373,28 +373,28 @@
    void setManagementNotificationAddress(SimpleString address);
 
    /**
-    * Returns the management cluster user for this server.
+    * Returns the cluster user for this server.
     * <br>
-    * Default value is {@value org.hornetq.core.config.impl.ConfigurationImpl#DEFAULT_MANAGEMENT_CLUSTER_USER}.
+    * Default value is {@value org.hornetq.core.config.impl.ConfigurationImpl#DEFAULT_CLUSTER_USER}.
     */
-   String getManagementClusterUser();
+   String getClusterUser();
 
    /**
-    * Sets the management cluster user for this server.
+    * Sets the cluster user for this server.
     */
-   void setManagementClusterUser(String user);
+   void setClusterUser(String user);
 
    /**
-    * Returns the management cluster password for this server.
+    * Returns the cluster password for this server.
     * <br>
-    * Default value is {@value org.hornetq.core.config.impl.ConfigurationImpl#DEFAULT_MANAGEMENT_CLUSTER_PASSWORD}.
+    * Default value is {@value org.hornetq.core.config.impl.ConfigurationImpl#DEFAULT_CLUSTER_PASSWORD}.
     */
-   String getManagementClusterPassword();
+   String getClusterPassword();
 
    /**
-    * Sets the management cluster password for this server.
+    * Sets the cluster password for this server.
     */
-   void setManagementClusterPassword(String password);
+   void setClusterPassword(String password);
 
    /**
     * Returns the size of the cache for pre-creating message IDs.

Modified: trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -137,9 +137,9 @@
 
    public static final SimpleString DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS = new SimpleString("hornetq.notifications");
 
-   public static final String DEFAULT_MANAGEMENT_CLUSTER_USER = "HORNETQ.MANAGEMENT.ADMIN.USER";
+   public static final String DEFAULT_CLUSTER_USER = "HORNETQ.CLUSTER.ADMIN.USER";
 
-   public static final String DEFAULT_MANAGEMENT_CLUSTER_PASSWORD = "CHANGE ME!!";
+   public static final String DEFAULT_CLUSTER_PASSWORD = "CHANGE ME!!";
 
    public static final long DEFAULT_BROADCAST_PERIOD = 1000;
 
@@ -303,9 +303,9 @@
 
    protected SimpleString managementNotificationAddress = ConfigurationImpl.DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS;
 
-   protected String managementClusterUser = ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER;
+   protected String clusterUser = ConfigurationImpl.DEFAULT_CLUSTER_USER;
 
-   protected String managementClusterPassword = ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD;
+   protected String clusterPassword = ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD;
 
    protected long serverDumpInterval = ConfigurationImpl.DEFAULT_SERVER_DUMP_INTERVAL;
 
@@ -841,24 +841,24 @@
       managementNotificationAddress = address;
    }
 
-   public String getManagementClusterUser()
+   public String getClusterUser()
    {
-      return managementClusterUser;
+      return clusterUser;
    }
 
-   public void setManagementClusterUser(final String user)
+   public void setClusterUser(final String user)
    {
-      managementClusterUser = user;
+      clusterUser = user;
    }
 
-   public String getManagementClusterPassword()
+   public String getClusterPassword()
    {
-      return managementClusterPassword;
+      return clusterPassword;
    }
 
-   public void setManagementClusterPassword(final String clusterPassword)
+   public void setClusterPassword(final String theclusterPassword)
    {
-      managementClusterPassword = clusterPassword;
+      clusterPassword = theclusterPassword;
    }
 
    public int getJournalCompactMinFiles()
@@ -1166,25 +1166,25 @@
       {
          return false;
       }
-      if (managementClusterPassword == null)
+      if (clusterPassword == null)
       {
-         if (other.managementClusterPassword != null)
+         if (other.clusterPassword != null)
          {
             return false;
          }
       }
-      else if (!managementClusterPassword.equals(other.managementClusterPassword))
+      else if (!clusterPassword.equals(other.clusterPassword))
       {
          return false;
       }
-      if (managementClusterUser == null)
+      if (clusterUser == null)
       {
-         if (other.managementClusterUser != null)
+         if (other.clusterUser != null)
          {
             return false;
          }
       }
-      else if (!managementClusterUser.equals(other.managementClusterUser))
+      else if (!clusterUser.equals(other.clusterUser))
       {
          return false;
       }

Modified: trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -25,7 +25,6 @@
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.server.JournalType;
 import org.hornetq.core.server.cluster.BridgeConfiguration;
@@ -171,15 +170,15 @@
                                                                                       managementNotificationAddress.toString(),
                                                                                       Validators.NOT_NULL_OR_EMPTY));
 
-      managementClusterPassword = XMLConfigurationUtil.getString(e,
-                                                                 "management-cluster-password",
-                                                                 managementClusterPassword,
-                                                                 Validators.NOT_NULL_OR_EMPTY);
+      clusterPassword = XMLConfigurationUtil.getString(e,
+                                                       "cluster-password",
+                                                       clusterPassword,
+                                                       Validators.NOT_NULL_OR_EMPTY);
 
-      managementClusterUser = XMLConfigurationUtil.getString(e,
-                                                             "management-cluster-user",
-                                                             managementClusterUser,
-                                                             Validators.NOT_NULL_OR_EMPTY);
+      clusterUser = XMLConfigurationUtil.getString(e,
+                                                   "cluster-user",
+                                                   clusterUser,
+                                                   Validators.NOT_NULL_OR_EMPTY);
 
       logDelegateFactoryClassName = XMLConfigurationUtil.getString(e,
                                                                    "log-delegate-factory-class-name",

Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -101,6 +101,10 @@
    private boolean backup;
 
    private volatile boolean started;
+   
+   private final String clusterUser;
+   
+   private final String clusterPassword;
 
    /*
     * Constructor using static list of connectors
@@ -119,7 +123,9 @@
                                 final List<Pair<TransportConfiguration, TransportConfiguration>> connectors,
                                 final int maxHops,
                                 final UUID nodeUUID,
-                                final boolean backup) throws Exception
+                                final boolean backup,
+                                final String clusterUser,
+                                final String clusterPassword) throws Exception
    {
       this.name = name;
 
@@ -157,6 +163,10 @@
       this.backup = backup;
 
       staticConnectors = connectors;
+      
+      this.clusterUser = clusterUser;
+      
+      this.clusterPassword = clusterPassword;
 
       if (!backup)
       {
@@ -181,7 +191,9 @@
                                 final DiscoveryGroup discoveryGroup,
                                 final int maxHops,
                                 final UUID nodeUUID,
-                                final boolean backup) throws Exception
+                                final boolean backup,
+                                final String clusterUser,
+                                final String clusterPassword) throws Exception
    {
       this.name = name;
 
@@ -212,6 +224,10 @@
       this.nodeUUID = nodeUUID;
 
       this.backup = backup;
+      
+      this.clusterUser = clusterUser;
+      
+      this.clusterPassword = clusterPassword;
 
       staticConnectors = null;
    }
@@ -443,8 +459,8 @@
                                      confirmationWindowSize,
                                      managementService.getManagementAddress(),
                                      managementService.getManagementNotificationAddress(),
-                                     managementService.getClusterUser(),
-                                     managementService.getClusterPassword(),
+                                     clusterUser,
+                                     clusterPassword,
                                      record,
                                      !backup,
                                      server.getStorageManager());

Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -425,8 +425,8 @@
                                  config.getConfirmationWindowSize(),
                                  managementService.getManagementAddress(),
                                  managementService.getManagementNotificationAddress(),
-                                 managementService.getClusterUser(),
-                                 managementService.getClusterPassword(),
+                                 server.getConfiguration().getClusterUser(),
+                                 server.getConfiguration().getClusterPassword(),
                                  null,
                                  !backup,
                                  server.getStorageManager());
@@ -479,8 +479,8 @@
                                  config.getConfirmationWindowSize(),
                                  managementService.getManagementAddress(),
                                  managementService.getManagementNotificationAddress(),
-                                 managementService.getClusterUser(),
-                                 managementService.getClusterPassword(),
+                                 server.getConfiguration().getClusterUser(),
+                                 server.getConfiguration().getClusterPassword(),
                                  null,
                                  !backup,
                                  server.getStorageManager());
@@ -562,7 +562,9 @@
                                                        connectors,
                                                        config.getMaxHops(),
                                                        nodeUUID,
-                                                       backup);
+                                                       backup,
+                                                       server.getConfiguration().getClusterUser(),
+                                                       server.getConfiguration().getClusterPassword());
       }
       else
       {
@@ -588,7 +590,9 @@
                                                        dg,
                                                        config.getMaxHops(),
                                                        nodeUUID,
-                                                       backup);
+                                                       backup,
+                                                       server.getConfiguration().getClusterUser(),
+                                                       server.getConfiguration().getClusterPassword());
       }
 
       managementService.registerCluster(clusterConnection, config);

Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -1037,12 +1037,18 @@
       securityRepository = new HierarchicalObjectRepository<Set<Role>>();
       securityRepository.setDefault(new HashSet<Role>());
 
+      if (ConfigurationImpl.DEFAULT_CLUSTER_USER.equals(configuration.getClusterUser()) && ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD.equals(configuration.getClusterPassword()))
+      {
+         log.warn("It has been detected that the cluster admin user and password which are used to " + "replicate management operation from one node to the other have not been changed from the installation default. "
+                  + "Please see the HornetQ user guide for instructions on how to do this.");
+      }
+
       securityStore = new SecurityStoreImpl(securityRepository,
                                             securityManager,
                                             configuration.getSecurityInvalidationInterval(),
                                             configuration.isSecurityEnabled(),
-                                            configuration.getManagementClusterUser(),
-                                            configuration.getManagementClusterPassword(),
+                                            configuration.getClusterUser(),
+                                            configuration.getClusterPassword(),
                                             managementService);
 
       queueFactory = new QueueFactoryImpl(executorFactory, scheduledPool, addressSettingsRepository, storageManager);

Modified: trunk/src/main/org/hornetq/core/server/management/ManagementService.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/management/ManagementService.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/main/org/hornetq/core/server/management/ManagementService.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -61,10 +61,6 @@
 
    MessageCounterManager getMessageCounterManager();
 
-   String getClusterUser();
-
-   String getClusterPassword();
-
    SimpleString getManagementAddress();
 
    SimpleString getManagementNotificationAddress();

Modified: trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -41,7 +41,6 @@
 import org.hornetq.api.core.management.ResourceNames;
 import org.hornetq.core.cluster.DiscoveryGroup;
 import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.management.impl.AcceptorControlImpl;
 import org.hornetq.core.management.impl.AddressControlImpl;
@@ -123,10 +122,6 @@
 
    private final SimpleString managementAddress;
 
-   private final String managementClusterUser;
-
-   private final String managementClusterPassword;
-
    private boolean started = false;
 
    private final boolean messageCounterEnabled;
@@ -139,15 +134,6 @@
 
    // Static --------------------------------------------------------
 
-   private static void checkDefaultManagementClusterCredentials(final String user, final String password)
-   {
-      if (ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER.equals(user) && ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD.equals(password))
-      {
-         ManagementServiceImpl.log.warn("It has been detected that the cluster admin user and password which are used to " + "replicate management operation from one node to the other have not been changed from the installation default. "
-                                        + "Please see the HornetQ user guide for instructions on how to do this.");
-      }
-   }
-
    // Constructor ----------------------------------------------------
 
    public ManagementServiceImpl(final MBeanServer mbeanServer, final Configuration configuration)
@@ -157,11 +143,7 @@
       messageCounterEnabled = configuration.isMessageCounterEnabled();
       managementAddress = configuration.getManagementAddress();
       managementNotificationAddress = configuration.getManagementNotificationAddress();
-      managementClusterUser = configuration.getManagementClusterUser();
-      managementClusterPassword = configuration.getManagementClusterPassword();
 
-      ManagementServiceImpl.checkDefaultManagementClusterCredentials(managementClusterUser, managementClusterPassword);
-
       registry = new HashMap<String, Object>();
       broadcaster = new NotificationBroadcasterSupport();
       notificationsEnabled = true;
@@ -593,16 +575,6 @@
       return managementNotificationAddress;
    }
 
-   public String getClusterUser()
-   {
-      return managementClusterUser;
-   }
-
-   public String getClusterPassword()
-   {
-      return managementClusterPassword;
-   }
-
    // HornetQComponent implementation -----------------------------
 
    public void start() throws Exception

Modified: trunk/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- trunk/tests/config/ConfigurationTest-full-config.xml	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/tests/config/ConfigurationTest-full-config.xml	2010-01-07 20:57:02 UTC (rev 8774)
@@ -12,8 +12,8 @@
       <wild-card-routing-enabled>true</wild-card-routing-enabled>
       <management-address>Giraffe</management-address>
       <management-notification-address>Whatever</management-notification-address>
-      <management-cluster-user>Frog</management-cluster-user>
-      <management-cluster-password>Wombat</management-cluster-password>
+      <cluster-user>Frog</cluster-user>
+      <cluster-password>Wombat</cluster-password>
       <jmx-management-enabled>false</jmx-management-enabled>
       <jmx-domain>gro.qtenroh</jmx-domain>
       <log-delegate-factory-class-name>ocelot</log-delegate-factory-class-name>

Modified: trunk/tests/joram-tests/src/org/hornetq/jms/HornetQAdmin.java
===================================================================
--- trunk/tests/joram-tests/src/org/hornetq/jms/HornetQAdmin.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/tests/joram-tests/src/org/hornetq/jms/HornetQAdmin.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -74,8 +74,8 @@
    public void start() throws Exception
    {
       ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl) HornetQClient.createClientSessionFactory(new TransportConfiguration(NettyConnectorFactory.class.getName()));
-      clientSession = sf.createSession(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER,
-                                       ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD,
+      clientSession = sf.createSession(ConfigurationImpl.DEFAULT_CLUSTER_USER,
+                                       ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD,
                                        false,
                                        true,
                                        true,

Modified: trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -58,8 +58,8 @@
     */
    public void testSendManagementMessageWithClusterAdminUser() throws Exception
    {
-      doSendManagementMessage(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER,
-                              ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD,
+      doSendManagementMessage(ConfigurationImpl.DEFAULT_CLUSTER_USER,
+                              ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD,
                               true);
    }
 

Modified: trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -40,8 +40,8 @@
 
    public void testSendManagementMessageWithDefaultClusterAdminUser() throws Exception
    {
-      doSendManagementMessage(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER,
-                              ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD,
+      doSendManagementMessage(ConfigurationImpl.DEFAULT_CLUSTER_USER,
+                              ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD,
                               true);
    }
 

Modified: trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/tests/src/org/hornetq/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -41,13 +41,13 @@
 
    public void testSendManagementMessageWithModifiedClusterAdminUser() throws Exception
    {
-      doSendManagementMessage(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER, configuredClusterPassword, true);
+      doSendManagementMessage(ConfigurationImpl.DEFAULT_CLUSTER_USER, configuredClusterPassword, true);
    }
 
    public void testSendManagementMessageWithDefaultClusterAdminUser() throws Exception
    {
-      doSendManagementMessage(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER,
-                              ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD,
+      doSendManagementMessage(ConfigurationImpl.DEFAULT_CLUSTER_USER,
+                              ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD,
                               false);
    }
 
@@ -70,7 +70,7 @@
    {
       ConfigurationImpl conf = new ConfigurationImpl();
       conf.setSecurityEnabled(true);
-      conf.setManagementClusterPassword(configuredClusterPassword);
+      conf.setClusterPassword(configuredClusterPassword);
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
       HornetQServer server = HornetQServers.newHornetQServer(conf, false);
       server.start();

Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/ConfigurationImplTest.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -72,8 +72,8 @@
       Assert.assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS, conf.getManagementAddress()); // OK
       Assert.assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS,
                           conf.getManagementNotificationAddress()); // OK
-      Assert.assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER, conf.getManagementClusterUser()); // OK
-      Assert.assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD, conf.getManagementClusterPassword()); // OK
+      Assert.assertEquals(ConfigurationImpl.DEFAULT_CLUSTER_USER, conf.getClusterUser()); // OK
+      Assert.assertEquals(ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD, conf.getClusterPassword()); // OK
       Assert.assertEquals(ConfigurationImpl.DEFAULT_PERSISTENCE_ENABLED, conf.isPersistenceEnabled());
       Assert.assertEquals(ConfigurationImpl.DEFAULT_FILE_DEPLOYMENT_ENABLED, conf.isFileDeploymentEnabled());
       Assert.assertEquals(ConfigurationImpl.DEFAULT_PERSIST_DELIVERY_COUNT_BEFORE_DELIVERY,
@@ -230,8 +230,8 @@
          Assert.assertEquals(ss, conf.getManagementNotificationAddress());
 
          s = RandomUtil.randomString();
-         conf.setManagementClusterUser(s);
-         Assert.assertEquals(s, conf.getManagementClusterUser());
+         conf.setClusterUser(s);
+         Assert.assertEquals(s, conf.getClusterUser());
 
          i = RandomUtil.randomInt();
          conf.setIDCacheSize(i);
@@ -310,8 +310,8 @@
          Assert.assertEquals(l, conf.getTransactionTimeoutScanPeriod());
 
          s = RandomUtil.randomString();
-         conf.setManagementClusterPassword(s);
-         Assert.assertEquals(s, conf.getManagementClusterPassword());
+         conf.setClusterPassword(s);
+         Assert.assertEquals(s, conf.getClusterPassword());
       }
    }
 
@@ -451,8 +451,8 @@
       Assert.assertEquals(ss, conf.getManagementNotificationAddress());
 
       s = RandomUtil.randomString();
-      conf.setManagementClusterUser(s);
-      Assert.assertEquals(s, conf.getManagementClusterUser());
+      conf.setClusterUser(s);
+      Assert.assertEquals(s, conf.getClusterUser());
 
       i = RandomUtil.randomInt();
       conf.setIDCacheSize(i);
@@ -531,8 +531,8 @@
       Assert.assertEquals(l, conf.getTransactionTimeoutScanPeriod());
 
       s = RandomUtil.randomString();
-      conf.setManagementClusterPassword(s);
-      Assert.assertEquals(s, conf.getManagementClusterPassword());
+      conf.setClusterPassword(s);
+      Assert.assertEquals(s, conf.getClusterPassword());
 
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       ObjectOutputStream oos = new ObjectOutputStream(baos);

Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -82,9 +82,9 @@
       Assert.assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS,
                           conf.getManagementNotificationAddress());
 
-      Assert.assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_USER, conf.getManagementClusterUser());
+      Assert.assertEquals(ConfigurationImpl.DEFAULT_CLUSTER_USER, conf.getClusterUser());
 
-      Assert.assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD, conf.getManagementClusterPassword());
+      Assert.assertEquals(ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD, conf.getClusterPassword());
 
       Assert.assertEquals(ConfigurationImpl.DEFAULT_ID_CACHE_SIZE, conf.getIDCacheSize());
 

Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java	2010-01-07 17:56:22 UTC (rev 8773)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java	2010-01-07 20:57:02 UTC (rev 8774)
@@ -47,8 +47,8 @@
       Assert.assertEquals(true, conf.isWildcardRoutingEnabled());
       Assert.assertEquals(new SimpleString("Giraffe"), conf.getManagementAddress());
       Assert.assertEquals(new SimpleString("Whatever"), conf.getManagementNotificationAddress());
-      Assert.assertEquals("Frog", conf.getManagementClusterUser());
-      Assert.assertEquals("Wombat", conf.getManagementClusterPassword());
+      Assert.assertEquals("Frog", conf.getClusterUser());
+      Assert.assertEquals("Wombat", conf.getClusterPassword());
       Assert.assertEquals(false, conf.isJMXManagementEnabled());
       Assert.assertEquals("gro.qtenroh", conf.getJMXDomain());
       Assert.assertEquals(true, conf.isMessageCounterEnabled());



More information about the hornetq-commits mailing list