[jboss-cvs] JBossAS SVN: r109374 - projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 18 15:48:18 EST 2010
Author: smarlow at redhat.com
Date: 2010-11-18 15:48:17 -0500 (Thu, 18 Nov 2010)
New Revision: 109374
Added:
projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory/ProtocolData.java
projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory/ProtocolParameter.java
Log:
JBCLUSTER-289 upgrade to JGroups 2.11.0.GA from 2.10.1.GA
Added: projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory/ProtocolData.java
===================================================================
--- projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory/ProtocolData.java (rev 0)
+++ projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory/ProtocolData.java 2010-11-18 20:48:17 UTC (rev 109374)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010 Red Hat, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.core.channelfactory;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Data holder for protocol
+ * @author Filip Hanik (<a href="mailto:filip at filip.net">filip at filip.net)
+ * @author Bela Ban
+ * @version $Id: ProtocolData.java,v 1.10 2009/05/13 05:35:45 belaban Exp $
+ */
+public class ProtocolData {
+ /** Map<String,ProtocolParameter> of property keys and values */
+ private final Map<String, ProtocolParameter> mParameters=new HashMap<String, ProtocolParameter>();
+ private final String mProtocolName;
+ private final String mClassName;
+
+ public ProtocolData(String protocolName,
+ String className,
+ List<ProtocolParameter> params) {
+ this(protocolName, className, params.toArray(new ProtocolParameter[params.size()]));
+ }
+
+ public ProtocolData(String protocolName,
+ String className,
+ ProtocolParameter[] params) {
+ mProtocolName=protocolName;
+ mClassName=className;
+ if(params != null) {
+ for(ProtocolParameter param : params) {
+ mParameters.put(param.getName(), param);
+ }
+ }
+ }
+
+ public String getClassName() {
+ return mClassName;
+ }
+
+ public String getProtocolName() {
+ return mProtocolName;
+ }
+
+ @Deprecated
+ public static String getDescription() {
+ return "n/a";
+ }
+
+ public Map<String, ProtocolParameter> getParameters() {
+ return mParameters;
+ }
+
+ @Deprecated
+ public static boolean isOverride() {
+ return false;
+ }
+
+ public ProtocolParameter[] getParametersAsArray() {
+ ProtocolParameter[] result=new ProtocolParameter[mParameters.size()];
+ Iterator<String> it=mParameters.keySet().iterator();
+ for(int i=0; i < result.length; i++) {
+ String key=(String)it.next();
+ result[i]=(ProtocolParameter)mParameters.get(key);
+ }
+ return result;
+ }
+
+
+ public void override(ProtocolParameter[] params) {
+ for(int i=0; i < params.length; i++)
+ mParameters.put(params[i].getName(), params[i]);
+ }
+
+ public String getProtocolString() {
+ StringBuilder buf=new StringBuilder(mClassName);
+ if(!mParameters.isEmpty()) {
+ buf.append('(');
+ Iterator<String> i=mParameters.keySet().iterator();
+ while(i.hasNext()) {
+ String key=(String)i.next();
+ ProtocolParameter param=(ProtocolParameter)mParameters.get(key);
+ buf.append(param.getParameterString());
+ if(i.hasNext()) buf.append(';');
+ }
+ buf.append(')');
+ }
+ return buf.toString();
+ }
+
+ public int hashCode() {
+ return mProtocolName.hashCode();
+ }
+
+ public boolean equals(Object another) {
+ return another instanceof ProtocolData && getProtocolName().equals(((ProtocolData)another).getProtocolName());
+ }
+
+
+}
Added: projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory/ProtocolParameter.java
===================================================================
--- projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory/ProtocolParameter.java (rev 0)
+++ projects/cluster/ha-server-core/trunk/src/main/java/org/jboss/ha/core/channelfactory/ProtocolParameter.java 2010-11-18 20:48:17 UTC (rev 109374)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010 Red Hat, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ha.core.channelfactory;
+
+/**
+ * Data holder for protocol data
+ *
+ * @author Filip Hanik (<a href="mailto:filip at filip.net">filip at filip.net)
+ * @author Bela Ban
+ * @version $Id: ProtocolParameter.java,v 1.6 2007/12/03 13:17:08 belaban Exp $
+ */
+public class ProtocolParameter {
+
+ private final String mParameterName;
+ private String mParameterValue;
+
+ public ProtocolParameter(String parameterName, String parameterValue) {
+ mParameterName=parameterName;
+ mParameterValue=parameterValue;
+ }
+
+ public String getName() {
+ return mParameterName;
+ }
+
+ public String getValue() {
+ return mParameterValue;
+ }
+
+ public void setValue(String replacement) {
+ mParameterValue=replacement;
+ }
+
+ public int hashCode() {
+ if(mParameterName != null)
+ return mParameterName.hashCode();
+ else
+ return -1;
+ }
+
+ public boolean equals(Object another) {
+ return another instanceof ProtocolParameter && getName().equals(((ProtocolParameter)another).getName());
+ }
+
+ public String getParameterString() {
+ StringBuilder buf=new StringBuilder(mParameterName);
+ if(mParameterValue != null)
+ buf.append('=').append(mParameterValue);
+ return buf.toString();
+ }
+
+ public String getParameterStringXml() {
+ StringBuilder buf=new StringBuilder(mParameterName);
+ if(mParameterValue != null)
+ buf.append("=\"").append(mParameterValue).append('\"');
+ return buf.toString();
+ }
+
+
+}
More information about the jboss-cvs-commits
mailing list