activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andytay...@apache.org
Subject [26/51] [partial] activemq-6 git commit: ACTIVEMQ6-2 Update to HQ master
Date Tue, 11 Nov 2014 11:00:56 GMT
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ConfigurationUtils.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ConfigurationUtils.java
index 72a132b..fe0c284 100644
--- a/hornetq-server/src/main/java/org/hornetq/core/config/ConfigurationUtils.java
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ConfigurationUtils.java
@@ -13,6 +13,23 @@
 package org.hornetq.core.config;
 
 import org.hornetq.api.core.HornetQIllegalStateException;
+import org.hornetq.core.config.ha.ColocatedPolicyConfiguration;
+import org.hornetq.core.config.ha.LiveOnlyPolicyConfiguration;
+import org.hornetq.core.config.ha.ReplicaPolicyConfiguration;
+import org.hornetq.core.config.ha.ReplicatedPolicyConfiguration;
+import org.hornetq.core.config.ha.SharedStoreMasterPolicyConfiguration;
+import org.hornetq.core.config.ha.SharedStoreSlavePolicyConfiguration;
+import org.hornetq.core.server.HornetQMessageBundle;
+import org.hornetq.core.server.cluster.ha.BackupPolicy;
+import org.hornetq.core.server.cluster.ha.ColocatedPolicy;
+import org.hornetq.core.server.cluster.ha.HAPolicy;
+import org.hornetq.core.server.cluster.ha.LiveOnlyPolicy;
+import org.hornetq.core.server.cluster.ha.ReplicaPolicy;
+import org.hornetq.core.server.cluster.ha.ReplicatedPolicy;
+import org.hornetq.core.server.cluster.ha.ScaleDownPolicy;
+import org.hornetq.core.server.cluster.ha.SharedStoreMasterPolicy;
+import org.hornetq.core.server.cluster.ha.SharedStoreSlavePolicy;
+
 public final class ConfigurationUtils
 {
 
@@ -21,9 +38,8 @@ public final class ConfigurationUtils
       // Utility class
    }
 
-   public static ClusterConnectionConfiguration getReplicationClusterConfiguration(Configuration
conf) throws HornetQIllegalStateException
+   public static ClusterConnectionConfiguration getReplicationClusterConfiguration(Configuration
conf, String replicationCluster) throws HornetQIllegalStateException
    {
-      final String replicationCluster = conf.getHAPolicy().getReplicationClustername();
       if (replicationCluster == null || replicationCluster.isEmpty())
          return conf.getClusterConfigurations().get(0);
       for (ClusterConnectionConfiguration clusterConf : conf.getClusterConfigurations())
@@ -33,4 +49,94 @@ public final class ConfigurationUtils
       }
       throw new HornetQIllegalStateException("Missing cluster-configuration for replication-clustername
'" + replicationCluster + "'.");
    }
+
+   public static HAPolicy getHAPolicy(HAPolicyConfiguration conf) throws HornetQIllegalStateException
+   {
+      if (conf == null)
+      {
+         return new LiveOnlyPolicy();
+      }
+
+      switch (conf.getType())
+      {
+         case LIVE_ONLY:
+         {
+            LiveOnlyPolicyConfiguration pc = (LiveOnlyPolicyConfiguration) conf;
+            return new LiveOnlyPolicy(getScaleDownPolicy(pc.getScaleDownConfiguration()));
+         }
+         case REPLICATED:
+         {
+            ReplicatedPolicyConfiguration pc = (ReplicatedPolicyConfiguration) conf;
+            return new ReplicatedPolicy(pc.isCheckForLiveServer(), pc.getGroupName(), pc.getClusterName());
+         }
+         case REPLICA:
+         {
+            ReplicaPolicyConfiguration pc = (ReplicaPolicyConfiguration) conf;
+            return new ReplicaPolicy(pc.getClusterName(), pc.getMaxSavedReplicatedJournalsSize(),
pc.getGroupName(), pc.isRestartBackup(), pc.isAllowFailBack(), pc.getFailbackDelay(), getScaleDownPolicy(pc.getScaleDownConfiguration()));
+         }
+         case SHARED_STORE_MASTER:
+         {
+            SharedStoreMasterPolicyConfiguration pc = (SharedStoreMasterPolicyConfiguration)
conf;
+            return new SharedStoreMasterPolicy(pc.getFailbackDelay(), pc.isFailoverOnServerShutdown());
+         }
+         case SHARED_STORE_SLAVE:
+         {
+            SharedStoreSlavePolicyConfiguration pc = (SharedStoreSlavePolicyConfiguration)
conf;
+            return new SharedStoreSlavePolicy(pc.getFailbackDelay(), pc.isFailoverOnServerShutdown(),
pc.isRestartBackup(), pc.isAllowFailBack(), getScaleDownPolicy(pc.getScaleDownConfiguration()));
+         }
+         case COLOCATED:
+         {
+            ColocatedPolicyConfiguration pc = (ColocatedPolicyConfiguration) conf;
+
+            HAPolicyConfiguration backupConf = pc.getBackupConfig();
+            BackupPolicy backupPolicy;
+            if (backupConf == null)
+            {
+               backupPolicy = new ReplicaPolicy();
+            }
+            else
+            {
+               backupPolicy = (BackupPolicy) getHAPolicy(backupConf);
+            }
+            HAPolicyConfiguration liveConf = pc.getLiveConfig();
+            HAPolicy livePolicy;
+            if (liveConf == null)
+            {
+               livePolicy = new ReplicatedPolicy();
+            }
+            else
+            {
+               livePolicy = getHAPolicy(liveConf);
+            }
+            return new ColocatedPolicy(pc.isRequestBackup(),
+                  pc.getBackupRequestRetries(),
+                  pc.getBackupRequestRetryInterval(),
+                  pc.getMaxBackups(),
+                  pc.getBackupPortOffset(),
+                  pc.getExcludedConnectors(),
+                  livePolicy,
+                  backupPolicy);
+         }
+
+      }
+      throw HornetQMessageBundle.BUNDLE.unsupportedHAPolicyConfiguration(conf);
+   }
+
+   public static ScaleDownPolicy getScaleDownPolicy(ScaleDownConfiguration scaleDownConfiguration)
+   {
+      if (scaleDownConfiguration != null)
+      {
+         if (scaleDownConfiguration.getDiscoveryGroup() != null)
+         {
+            return new ScaleDownPolicy(scaleDownConfiguration.getDiscoveryGroup(), scaleDownConfiguration.getGroupName(),
+                  scaleDownConfiguration.getClusterName(), scaleDownConfiguration.isEnabled());
+         }
+         else
+         {
+            return new ScaleDownPolicy(scaleDownConfiguration.getConnectors(), scaleDownConfiguration.getGroupName(),
+                  scaleDownConfiguration.getClusterName(), scaleDownConfiguration.isEnabled());
+         }
+      }
+      return null;
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ConnectorServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ConnectorServiceConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ConnectorServiceConfiguration.java
index 26ec18c..3121c1f 100644
--- a/hornetq-server/src/main/java/org/hornetq/core/config/ConnectorServiceConfiguration.java
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ConnectorServiceConfiguration.java
@@ -23,17 +23,14 @@ public class ConnectorServiceConfiguration implements Serializable
 {
    private static final long serialVersionUID = -641207073030767325L;
 
-   private final String name;
+   private String name;
 
-   private final  String factoryClassName;
+   private String factoryClassName;
 
-   private final  Map<String, Object> params;
+   private Map<String, Object> params;
 
-   public ConnectorServiceConfiguration(final String clazz, final Map<String, Object>
params, final String name)
+   public ConnectorServiceConfiguration()
    {
-      this.name = name;
-      factoryClassName = clazz;
-      this.params = params;
    }
 
    public String getConnectorName()
@@ -51,6 +48,29 @@ public class ConnectorServiceConfiguration implements Serializable
       return params;
    }
 
+   public String getName()
+   {
+      return name;
+   }
+
+   public ConnectorServiceConfiguration setName(String name)
+   {
+      this.name = name;
+      return this;
+   }
+
+   public ConnectorServiceConfiguration setFactoryClassName(String factoryClassName)
+   {
+      this.factoryClassName = factoryClassName;
+      return this;
+   }
+
+   public ConnectorServiceConfiguration setParams(Map<String, Object> params)
+   {
+      this.params = params;
+      return this;
+   }
+
    @Override
    public boolean equals(Object o)
    {

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/CoreQueueConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/CoreQueueConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/CoreQueueConfiguration.java
index 51422a3..7ba64ef 100644
--- a/hornetq-server/src/main/java/org/hornetq/core/config/CoreQueueConfiguration.java
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/CoreQueueConfiguration.java
@@ -22,20 +22,16 @@ public class CoreQueueConfiguration implements Serializable
 {
    private static final long serialVersionUID = 650404974977490254L;
 
-   private String address;
+   private String address = null;
 
-   private String name;
+   private String name = null;
 
-   private String filterString;
+   private String filterString = null;
 
-   private boolean durable;
+   private boolean durable = true;
 
-   public CoreQueueConfiguration(final String address, final String name, final String filterString,
final boolean durable)
+   public CoreQueueConfiguration()
    {
-      this.address = address;
-      this.name = name;
-      this.filterString = filterString;
-      this.durable = durable;
    }
 
    public String getAddress()
@@ -61,33 +57,37 @@ public class CoreQueueConfiguration implements Serializable
    /**
     * @param address the address to set
     */
-   public void setAddress(final String address)
+   public CoreQueueConfiguration setAddress(final String address)
    {
       this.address = address;
+      return this;
    }
 
    /**
     * @param name the name to set
     */
-   public void setName(final String name)
+   public CoreQueueConfiguration setName(final String name)
    {
       this.name = name;
+      return this;
    }
 
    /**
     * @param filterString the filterString to set
     */
-   public void setFilterString(final String filterString)
+   public CoreQueueConfiguration setFilterString(final String filterString)
    {
       this.filterString = filterString;
+      return this;
    }
 
    /**
-    * @param durable the durable to set
+    * @param durable the durable to set; default value is true
     */
-   public void setDurable(final boolean durable)
+   public CoreQueueConfiguration setDurable(final boolean durable)
    {
       this.durable = durable;
+      return this;
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/DivertConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/DivertConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/DivertConfiguration.java
index 1dab186..45b1179 100644
--- a/hornetq-server/src/main/java/org/hornetq/core/config/DivertConfiguration.java
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/DivertConfiguration.java
@@ -14,6 +14,7 @@ package org.hornetq.core.config;
 
 import java.io.Serializable;
 
+import org.hornetq.api.config.HornetQDefaultConfiguration;
 import org.hornetq.utils.UUIDGenerator;
 
 /**
@@ -25,42 +26,22 @@ public class DivertConfiguration implements Serializable
 {
    private static final long serialVersionUID = 6910543740464269629L;
 
-   private String name;
+   private String name = null;
 
-   private String routingName;
+   private String routingName = UUIDGenerator.getInstance().generateStringUUID();
 
-   private String address;
+   private String address = null;
 
-   private String forwardingAddress;
+   private String forwardingAddress = null;
 
-   private boolean exclusive;
+   private boolean exclusive = HornetQDefaultConfiguration.isDefaultDivertExclusive();
 
-   private String filterString;
+   private String filterString = null;
 
-   private String transformerClassName;
+   private String transformerClassName = null;
 
-   public DivertConfiguration(final String name,
-                              final String routingName,
-                              final String address,
-                              final String forwardingAddress,
-                              final boolean exclusive,
-                              final String filterString,
-                              final String transformerClassName)
+   public DivertConfiguration()
    {
-      this.name = name;
-      if (routingName == null)
-      {
-         this.routingName = UUIDGenerator.getInstance().generateStringUUID();
-      }
-      else
-      {
-         this.routingName = routingName;
-      }
-      this.address = address;
-      this.forwardingAddress = forwardingAddress;
-      this.exclusive = exclusive;
-      this.filterString = filterString;
-      this.transformerClassName = transformerClassName;
    }
 
    public String getName()
@@ -101,57 +82,64 @@ public class DivertConfiguration implements Serializable
    /**
     * @param name the name to set
     */
-   public void setName(final String name)
+   public DivertConfiguration setName(final String name)
    {
       this.name = name;
+      return this;
    }
 
    /**
     * @param routingName the routingName to set
     */
-   public void setRoutingName(final String routingName)
+   public DivertConfiguration setRoutingName(final String routingName)
    {
       this.routingName = routingName;
+      return this;
    }
 
    /**
     * @param address the address to set
     */
-   public void setAddress(final String address)
+   public DivertConfiguration setAddress(final String address)
    {
       this.address = address;
+      return this;
    }
 
    /**
     * @param forwardingAddress the forwardingAddress to set
     */
-   public void setForwardingAddress(final String forwardingAddress)
+   public DivertConfiguration setForwardingAddress(final String forwardingAddress)
    {
       this.forwardingAddress = forwardingAddress;
+      return this;
    }
 
    /**
     * @param exclusive the exclusive to set
     */
-   public void setExclusive(final boolean exclusive)
+   public DivertConfiguration setExclusive(final boolean exclusive)
    {
       this.exclusive = exclusive;
+      return this;
    }
 
    /**
     * @param filterString the filterString to set
     */
-   public void setFilterString(final String filterString)
+   public DivertConfiguration setFilterString(final String filterString)
    {
       this.filterString = filterString;
+      return this;
    }
 
    /**
     * @param transformerClassName the transformerClassName to set
     */
-   public void setTransformerClassName(final String transformerClassName)
+   public DivertConfiguration setTransformerClassName(final String transformerClassName)
    {
       this.transformerClassName = transformerClassName;
+      return this;
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/HAPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/HAPolicyConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/HAPolicyConfiguration.java
new file mode 100644
index 0000000..c1d68ca
--- /dev/null
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/HAPolicyConfiguration.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.core.config;
+
+import java.io.Serializable;
+
+public interface HAPolicyConfiguration extends Serializable
+{
+   public enum TYPE
+   {
+      LIVE_ONLY,
+      REPLICATED,
+      REPLICA,
+      SHARED_STORE_MASTER,
+      SHARED_STORE_SLAVE,
+      COLOCATED
+   }
+
+   TYPE getType();
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ScaleDownConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ScaleDownConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ScaleDownConfiguration.java
new file mode 100644
index 0000000..9a685aa
--- /dev/null
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ScaleDownConfiguration.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.core.config;
+
+import org.hornetq.api.config.HornetQDefaultConfiguration;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ScaleDownConfiguration implements Serializable
+{
+   private List<String> connectors = new ArrayList<>();
+
+   private String discoveryGroup = null;
+
+   private String groupName = null;
+
+   private String clusterName = null;
+
+   private boolean enabled = HornetQDefaultConfiguration.isDefaultScaleDownEnabled();
+
+   public List<String> getConnectors()
+   {
+      return connectors;
+   }
+
+   public ScaleDownConfiguration setConnectors(List<String> connectors)
+   {
+      this.connectors = connectors;
+      return this;
+   }
+
+   public ScaleDownConfiguration addConnector(String connector)
+   {
+      connectors.add(connector);
+      return this;
+   }
+
+   public String getDiscoveryGroup()
+   {
+      return discoveryGroup;
+   }
+
+   public ScaleDownConfiguration setDiscoveryGroup(String discoveryGroup)
+   {
+      this.discoveryGroup = discoveryGroup;
+      return this;
+   }
+
+   public String getGroupName()
+   {
+      return groupName;
+   }
+
+   public ScaleDownConfiguration setGroupName(String groupName)
+   {
+      this.groupName = groupName;
+      return this;
+   }
+
+   public String getClusterName()
+   {
+      return clusterName;
+   }
+
+   public ScaleDownConfiguration setClusterName(String clusterName)
+   {
+      this.clusterName = clusterName;
+      return this;
+   }
+
+   public boolean isEnabled()
+   {
+      return enabled;
+   }
+
+   public ScaleDownConfiguration setEnabled(boolean enabled)
+   {
+      this.enabled = enabled;
+      return this;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ha/ColocatedPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ha/ColocatedPolicyConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ha/ColocatedPolicyConfiguration.java
new file mode 100644
index 0000000..f5c930b
--- /dev/null
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ha/ColocatedPolicyConfiguration.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.core.config.ha;
+
+import org.hornetq.api.config.HornetQDefaultConfiguration;
+import org.hornetq.core.config.HAPolicyConfiguration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ColocatedPolicyConfiguration implements HAPolicyConfiguration
+{
+   private boolean requestBackup = HornetQDefaultConfiguration.isDefaultHapolicyRequestBackup();
+
+   private int backupRequestRetries = HornetQDefaultConfiguration.getDefaultHapolicyBackupRequestRetries();
+
+   private long backupRequestRetryInterval = HornetQDefaultConfiguration.getDefaultHapolicyBackupRequestRetryInterval();
+
+   private int maxBackups = HornetQDefaultConfiguration.getDefaultHapolicyMaxBackups();
+
+   private int backupPortOffset = HornetQDefaultConfiguration.getDefaultHapolicyBackupPortOffset();
+
+   private List<String> excludedConnectors = new ArrayList<>();
+
+   private int portOffset = HornetQDefaultConfiguration.getDefaultHapolicyBackupPortOffset();
+
+   private HAPolicyConfiguration liveConfig;
+
+   private HAPolicyConfiguration backupConfig;
+
+   public ColocatedPolicyConfiguration()
+   {
+   }
+
+   @Override
+   public TYPE getType()
+   {
+      return TYPE.COLOCATED;
+   }
+
+   public boolean isRequestBackup()
+   {
+      return requestBackup;
+   }
+
+   public ColocatedPolicyConfiguration setRequestBackup(boolean requestBackup)
+   {
+      this.requestBackup = requestBackup;
+      return this;
+   }
+
+   public int getBackupRequestRetries()
+   {
+      return backupRequestRetries;
+   }
+
+   public ColocatedPolicyConfiguration setBackupRequestRetries(int backupRequestRetries)
+   {
+      this.backupRequestRetries = backupRequestRetries;
+      return this;
+   }
+
+   public long getBackupRequestRetryInterval()
+   {
+      return backupRequestRetryInterval;
+   }
+
+   public ColocatedPolicyConfiguration setBackupRequestRetryInterval(long backupRequestRetryInterval)
+   {
+      this.backupRequestRetryInterval = backupRequestRetryInterval;
+      return this;
+   }
+
+   public int getMaxBackups()
+   {
+      return maxBackups;
+   }
+
+   public ColocatedPolicyConfiguration setMaxBackups(int maxBackups)
+   {
+      this.maxBackups = maxBackups;
+      return this;
+   }
+
+   public int getBackupPortOffset()
+   {
+      return backupPortOffset;
+   }
+
+   public ColocatedPolicyConfiguration setBackupPortOffset(int backupPortOffset)
+   {
+      this.backupPortOffset = backupPortOffset;
+      return this;
+   }
+
+   public List<String> getExcludedConnectors()
+   {
+      return excludedConnectors;
+   }
+
+   public ColocatedPolicyConfiguration setExcludedConnectors(List<String> excludedConnectors)
+   {
+      this.excludedConnectors = excludedConnectors;
+      return this;
+   }
+
+   public int getPortOffset()
+   {
+      return portOffset;
+   }
+
+   public ColocatedPolicyConfiguration setPortOffset(int portOffset)
+   {
+      this.portOffset = portOffset;
+      return this;
+   }
+
+   public HAPolicyConfiguration getLiveConfig()
+   {
+      return liveConfig;
+   }
+
+   public ColocatedPolicyConfiguration setLiveConfig(HAPolicyConfiguration liveConfig)
+   {
+      this.liveConfig = liveConfig;
+      return this;
+   }
+
+   public HAPolicyConfiguration getBackupConfig()
+   {
+      return backupConfig;
+   }
+
+   public ColocatedPolicyConfiguration setBackupConfig(HAPolicyConfiguration backupConfig)
+   {
+      this.backupConfig = backupConfig;
+      return this;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ha/LiveOnlyPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ha/LiveOnlyPolicyConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ha/LiveOnlyPolicyConfiguration.java
new file mode 100644
index 0000000..622af31
--- /dev/null
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ha/LiveOnlyPolicyConfiguration.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.core.config.ha;
+
+import org.hornetq.core.config.HAPolicyConfiguration;
+import org.hornetq.core.config.ScaleDownConfiguration;
+
+public class LiveOnlyPolicyConfiguration implements HAPolicyConfiguration
+{
+   public LiveOnlyPolicyConfiguration()
+   {
+   }
+
+   public LiveOnlyPolicyConfiguration(ScaleDownConfiguration scaleDownConfiguration)
+   {
+      this.scaleDownConfiguration = scaleDownConfiguration;
+   }
+
+   @Override
+   public TYPE getType()
+   {
+      return TYPE.LIVE_ONLY;
+   }
+
+   public ScaleDownConfiguration getScaleDownConfiguration()
+   {
+      return scaleDownConfiguration;
+   }
+
+   public void setScaleDownConfiguration(ScaleDownConfiguration scaleDownConfiguration)
+   {
+      this.scaleDownConfiguration = scaleDownConfiguration;
+   }
+
+   ScaleDownConfiguration scaleDownConfiguration;
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ha/ReplicaPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ha/ReplicaPolicyConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ha/ReplicaPolicyConfiguration.java
new file mode 100644
index 0000000..fa3eaf9
--- /dev/null
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ha/ReplicaPolicyConfiguration.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.core.config.ha;
+
+import org.hornetq.api.config.HornetQDefaultConfiguration;
+import org.hornetq.core.config.HAPolicyConfiguration;
+import org.hornetq.core.config.ScaleDownConfiguration;
+
+public class ReplicaPolicyConfiguration implements HAPolicyConfiguration
+{
+   private String clusterName = null;
+
+   private int maxSavedReplicatedJournalsSize = HornetQDefaultConfiguration.getDefaultMaxSavedReplicatedJournalsSize();
+
+   private String groupName = null;
+
+   private boolean restartBackup = HornetQDefaultConfiguration.isDefaultRestartBackup();
+
+   private ScaleDownConfiguration scaleDownConfiguration;
+
+   /*
+   * used in the replicated policy after failover
+   * */
+   private boolean allowFailBack = false;
+
+   private long failbackDelay = HornetQDefaultConfiguration.getDefaultFailbackDelay();
+
+   public ReplicaPolicyConfiguration()
+   {
+   }
+
+   @Override
+   public TYPE getType()
+   {
+      return TYPE.REPLICA;
+   }
+
+   public ScaleDownConfiguration getScaleDownConfiguration()
+   {
+      return scaleDownConfiguration;
+   }
+
+   public ReplicaPolicyConfiguration setScaleDownConfiguration(ScaleDownConfiguration scaleDownConfiguration)
+   {
+      this.scaleDownConfiguration = scaleDownConfiguration;
+      return this;
+   }
+
+   public String getClusterName()
+   {
+      return clusterName;
+   }
+
+   public ReplicaPolicyConfiguration setClusterName(String clusterName)
+   {
+      this.clusterName = clusterName;
+      return this;
+   }
+
+   public int getMaxSavedReplicatedJournalsSize()
+   {
+      return maxSavedReplicatedJournalsSize;
+   }
+
+   public ReplicaPolicyConfiguration setMaxSavedReplicatedJournalsSize(int maxSavedReplicatedJournalsSize)
+   {
+      this.maxSavedReplicatedJournalsSize = maxSavedReplicatedJournalsSize;
+      return this;
+   }
+
+   public String getGroupName()
+   {
+      return groupName;
+   }
+
+   public ReplicaPolicyConfiguration setGroupName(String groupName)
+   {
+      this.groupName = groupName;
+      return this;
+   }
+
+   public boolean isRestartBackup()
+   {
+      return restartBackup;
+   }
+
+   public ReplicaPolicyConfiguration setRestartBackup(boolean restartBackup)
+   {
+      this.restartBackup = restartBackup;
+      return this;
+   }
+
+   public boolean isAllowFailBack()
+   {
+      return allowFailBack;
+   }
+
+   public ReplicaPolicyConfiguration setAllowFailBack(boolean allowFailBack)
+   {
+      this.allowFailBack = allowFailBack;
+      return this;
+   }
+
+   public ReplicaPolicyConfiguration setFailbackDelay(long failbackDelay)
+   {
+      this.failbackDelay = failbackDelay;
+      return this;
+   }
+
+   public long getFailbackDelay()
+   {
+      return failbackDelay;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ha/ReplicatedPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ha/ReplicatedPolicyConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ha/ReplicatedPolicyConfiguration.java
new file mode 100644
index 0000000..5a1e2ec
--- /dev/null
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ha/ReplicatedPolicyConfiguration.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.core.config.ha;
+
+import org.hornetq.api.config.HornetQDefaultConfiguration;
+import org.hornetq.core.config.HAPolicyConfiguration;
+
+public class ReplicatedPolicyConfiguration implements HAPolicyConfiguration
+{
+   private boolean checkForLiveServer = HornetQDefaultConfiguration.isDefaultCheckForLiveServer();
+
+   private String groupName = null;
+
+   private String clusterName = null;
+
+   public ReplicatedPolicyConfiguration()
+   {
+   }
+
+   @Override
+   public TYPE getType()
+   {
+      return TYPE.REPLICATED;
+   }
+
+   public boolean isCheckForLiveServer()
+   {
+      return checkForLiveServer;
+   }
+
+   public ReplicatedPolicyConfiguration setCheckForLiveServer(boolean checkForLiveServer)
+   {
+      this.checkForLiveServer = checkForLiveServer;
+      return this;
+   }
+
+   public String getGroupName()
+   {
+      return groupName;
+   }
+
+   public ReplicatedPolicyConfiguration setGroupName(String groupName)
+   {
+      this.groupName = groupName;
+      return this;
+   }
+
+   public String getClusterName()
+   {
+      return clusterName;
+   }
+
+   public ReplicatedPolicyConfiguration setClusterName(String clusterName)
+   {
+      this.clusterName = clusterName;
+      return this;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ha/SharedStoreMasterPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ha/SharedStoreMasterPolicyConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ha/SharedStoreMasterPolicyConfiguration.java
new file mode 100644
index 0000000..60de542
--- /dev/null
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ha/SharedStoreMasterPolicyConfiguration.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.core.config.ha;
+
+import org.hornetq.api.config.HornetQDefaultConfiguration;
+import org.hornetq.core.config.HAPolicyConfiguration;
+
+public class SharedStoreMasterPolicyConfiguration implements HAPolicyConfiguration
+{
+   private long failbackDelay = HornetQDefaultConfiguration.getDefaultFailbackDelay();
+
+   private boolean failoverOnServerShutdown = HornetQDefaultConfiguration.isDefaultFailoverOnServerShutdown();
+
+   public SharedStoreMasterPolicyConfiguration()
+   {
+   }
+
+   @Override
+   public TYPE getType()
+   {
+      return TYPE.SHARED_STORE_MASTER;
+   }
+
+   public long getFailbackDelay()
+   {
+      return failbackDelay;
+   }
+
+   public SharedStoreMasterPolicyConfiguration setFailbackDelay(long failbackDelay)
+   {
+      this.failbackDelay = failbackDelay;
+      return this;
+   }
+
+   public boolean isFailoverOnServerShutdown()
+   {
+      return failoverOnServerShutdown;
+   }
+
+   public SharedStoreMasterPolicyConfiguration setFailoverOnServerShutdown(boolean failoverOnServerShutdown)
+   {
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
+      return this;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/177e6820/hornetq-server/src/main/java/org/hornetq/core/config/ha/SharedStoreSlavePolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/hornetq-server/src/main/java/org/hornetq/core/config/ha/SharedStoreSlavePolicyConfiguration.java
b/hornetq-server/src/main/java/org/hornetq/core/config/ha/SharedStoreSlavePolicyConfiguration.java
new file mode 100644
index 0000000..a0c8da1
--- /dev/null
+++ b/hornetq-server/src/main/java/org/hornetq/core/config/ha/SharedStoreSlavePolicyConfiguration.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.core.config.ha;
+
+import org.hornetq.api.config.HornetQDefaultConfiguration;
+import org.hornetq.core.config.HAPolicyConfiguration;
+import org.hornetq.core.config.ScaleDownConfiguration;
+
+public class SharedStoreSlavePolicyConfiguration implements HAPolicyConfiguration
+{
+   private long failbackDelay = HornetQDefaultConfiguration.getDefaultFailbackDelay();
+
+   private boolean failoverOnServerShutdown = HornetQDefaultConfiguration.isDefaultFailoverOnServerShutdown();
+
+   private boolean restartBackup = HornetQDefaultConfiguration.isDefaultRestartBackup();
+
+   private boolean allowFailBack = HornetQDefaultConfiguration.isDefaultAllowAutoFailback();
+
+   private ScaleDownConfiguration scaleDownConfiguration;
+
+   public SharedStoreSlavePolicyConfiguration()
+   {
+   }
+
+   @Override
+   public TYPE getType()
+   {
+      return TYPE.SHARED_STORE_SLAVE;
+   }
+
+   public boolean isRestartBackup()
+   {
+      return restartBackup;
+   }
+
+   public SharedStoreSlavePolicyConfiguration setRestartBackup(boolean restartBackup)
+   {
+      this.restartBackup = restartBackup;
+      return this;
+   }
+
+   public ScaleDownConfiguration getScaleDownConfiguration()
+   {
+      return scaleDownConfiguration;
+   }
+
+   public SharedStoreSlavePolicyConfiguration setScaleDownConfiguration(ScaleDownConfiguration
scaleDownConfiguration)
+   {
+      this.scaleDownConfiguration = scaleDownConfiguration;
+      return this;
+   }
+
+   public boolean isAllowFailBack()
+   {
+      return allowFailBack;
+   }
+
+   public SharedStoreSlavePolicyConfiguration setAllowFailBack(boolean allowFailBack)
+   {
+      this.allowFailBack = allowFailBack;
+      return this;
+   }
+
+   public boolean isFailoverOnServerShutdown()
+   {
+      return failoverOnServerShutdown;
+   }
+
+   public SharedStoreSlavePolicyConfiguration setFailoverOnServerShutdown(boolean failoverOnServerShutdown)
+   {
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
+      return this;
+   }
+
+   public long getFailbackDelay()
+   {
+      return failbackDelay;
+   }
+
+   public SharedStoreSlavePolicyConfiguration setFailbackDelay(long failbackDelay)
+   {
+      this.failbackDelay = failbackDelay;
+      return this;
+   }
+
+}


Mime
View raw message