Commit ddc17473 authored by Guillaume Surrel's avatar Guillaume Surrel
Browse files

Rework cluster notifications.

parent 121bb083
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - ScalAgent Distributed Technologies
* Copyright (C) 1996 - Dyade
*
* This library 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 any later version.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): Frederic Maistre (INRIA)
* Contributor(s):
*/
package org.objectweb.joram.mom.dest;
import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.agent.Notification;
/**
* A <code>ClusterAck</code> instance is a notification sent by a topic
* requested to join a cluster.
*/
class ClusterAck extends Notification {
/** define serialVersionUID for interoperability */
private static final long serialVersionUID = 1L;
/** <code>true</code> if the topic can join the cluster. */
boolean ok;
/** Info. */
String info;
/** The JMS destination to send the reply */
private AgentId replyTo = null;
/** The JMS message id. of the request needed for the reply */
private String requestMsgId;
/** The generated JMS message id. for the reply */
private String replyMsgId;
/**
* Constructs a <code>ClusterAck</code> instance.
*
* @param ok <code>true</code> if the topic can join the cluster.
* @param info Related info.
* @param replyTo The JMS destination to send the reply.
* @param requestMsgId The JMS message id. of the request needed for the reply.
* @param replyMsgId The generated JMS message id. for the reply.
*/
ClusterAck(boolean ok, String info,
AgentId replyTo, String requestMsgId, String replyMsgId) {
this.ok = ok;
this.info = info;
this.replyTo = replyTo;
this.requestMsgId = requestMsgId;
this.replyMsgId = replyMsgId;
}
/**
* Returns the JMS destination to send the reply.
*
* @return The JMS destination to send the reply.
*/
public AgentId getReplyTo() {
return replyTo;
}
/**
* Returns the JMS message id. of the request needed for the reply.
*
* @return The JMS message id. of the request needed for the reply.
*/
public String getRequestMsgId() {
return requestMsgId;
}
/**
* Returns the generated JMS message id. for the reply.
*
* @return The generated JMS message id. for the reply.
*/
public String getReplyMsgId() {
return replyMsgId;
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2004 - France Telecom R&D
*
* This library 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 any later version.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): Nicolas Tachker (ScalAgent)
* Contributor(s):
*/
package org.objectweb.joram.mom.notifications;
import java.util.Hashtable;
public class AckJoinQueueCluster extends JoinQueueCluster {
/**
*
*/
private static final long serialVersionUID = 1L;
public AckJoinQueueCluster(float rateOfFlow,
Hashtable clusters,
Hashtable clients,
boolean freeReading,
boolean freeWriting) {
super(rateOfFlow,
clusters,
clients,
freeReading,
freeWriting);
}
/**
* Appends a string image for this object to the StringBuffer parameter.
*
* @param output
* buffer to fill in
* @return
<code>output</code> buffer is returned
*/
public StringBuffer toString(StringBuffer output) {
output.append('(');
super.toString(output);
output.append(",clusters=").append(clusters);
output.append(",clients=").append(clients);
output.append(",freeReading=").append(freeReading);
output.append(",freeWriting=").append(freeWriting);
output.append(')');
return output;
}
}
......@@ -28,61 +28,41 @@ package org.objectweb.joram.mom.notifications;
* a client administration request.
*/
public class AdminReplyNot extends AbstractNotification {
/** define serialVersionUID for interoperability */
private static final long serialVersionUID = 1L;
/** Field identifying the original request. */
private String requestId;
/** <code>true</code> if the request succeeded. */
private boolean success;
/** Info related to the processing of the request. */
private String info;
/** possible return object */
private Object replyObj;
/**
* Constructs an <code>AdminReply</code>.
*/
public AdminReplyNot(AdminRequestNot request,
boolean success,
String info) {
this(request, success, info, null);
}
/**
* Constructs an <code>AdminReply</code>.
*/
public AdminReplyNot(AdminRequestNot request,
boolean success,
String info,
Object replyObj) {
public AdminReplyNot(AdminRequestNot request, boolean success, String info) {
requestId = request.getId();
this.success = success;
this.info = info;
this.replyObj = replyObj;
}
/** Returns the request identifier. */
public String getRequestId()
{
public String getRequestId() {
return requestId;
}
/** Returns <code>true</code> if the request was successful. */
public boolean getSuccess()
{
public boolean getSuccess() {
return success;
}
/** Returns the info related to the processing of the request. */
public String getInfo()
{
public String getInfo() {
return info;
}
/** Returns an object related to the processing of the request. */
public Object getReplyObject() {
return replyObj;
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - ScalAgent Distributed Technologies
* Copyright (C) 1996 - Dyade
* Copyright (C) 2005 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 2004 - France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -18,32 +18,30 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): Frederic Maistre (INRIA)
* Initial developer(s): Nicolas Tachker (ScalAgent)
* Contributor(s):
*/
package org.objectweb.joram.mom.dest;
package org.objectweb.joram.mom.notifications;
import java.util.Set;
import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.agent.Notification;
/**
* A <code>ClusterNot</code> instance is a notification sent by a topic
* to another topic for notifying it of a topic joining the cluster they
* are part of.
*/
class ClusterNot extends Notification {
/** define serialVersionUID for interoperability */
private static final long serialVersionUID = 1L;
public class ClusterJoinAck extends Notification {
/** The identifier of the topic to add to the cluster. */
AgentId topicId;
private static final long serialVersionUID = 1L;
private Set cluster;
public ClusterJoinAck(Set cluster) {
this.cluster = cluster;
}
/**
* Constructs a <code>ClusterNot</code> instance.
*
* @param topicId The identifier of the topic to add to the cluster.
* @return the cluster
*/
ClusterNot(AgentId topicId) {
this.topicId = topicId;
public Set getCluster() {
return cluster;
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - ScalAgent Distributed Technologies
* Copyright (C) 1996 - Dyade
* Copyright (C) 2005 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 2004 - France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -18,54 +18,49 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): Frederic Maistre (INRIA)
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package org.objectweb.joram.mom.dest;
package org.objectweb.joram.mom.notifications;
import java.util.Set;
import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.agent.Notification;
/**
* A <code>ClusterTest</code> instance is a notification sent by a topic
* to another topic for checking if it might be part of a cluster.
*/
class ClusterTest extends Notification {
/** define serialVersionUID for interoperability */
public class ClusterJoinNot extends Notification {
private static final long serialVersionUID = 1L;
/** Set containing AgentId of topics already in the cluster */
Set friends;
private Set cluster;
/** The JMS destination to send the reply */
private AgentId replyTo = null;
/** The JMS message id. of the request needed for the reply */
private String requestMsgId;
/** The generated JMS message id. for the reply */
private String replyMsgId;
/**
* Constructs a <code>ClusterTest</code> instance.
*
* @param requester The original requester.
* @param friends The current members of the cluster.
* @param replyTo The JMS destination to send the reply.
* @param requestMsgId The JMS message id. of the request needed for the reply.
* @param replyMsgId The generated JMS message id. for the reply.
*/
ClusterTest(Set friends,
AgentId replyTo, String requestMsgId, String replyMsgId) {
this.friends = friends;
public ClusterJoinNot(Set cluster, AgentId replyTo, String requestMsgId, String replyMsgId) {
this.cluster = cluster;
this.replyTo = replyTo;
this.requestMsgId = requestMsgId;
this.replyMsgId = replyMsgId;
}
/**
* @return the cluster
*/
public Set getCluster() {
return cluster;
}
/**
* Returns the JMS destination to send the reply.
*
* @return The JMS destination to send the reply.
* @return The JMS destination to send the reply.
*/
public AgentId getReplyTo() {
return replyTo;
......@@ -74,7 +69,7 @@ class ClusterTest extends Notification {
/**
* Returns the JMS message id. of the request needed for the reply.
*
* @return The JMS message id. of the request needed for the reply.
* @return The JMS message id. of the request needed for the reply.
*/
public String getRequestMsgId() {
return requestMsgId;
......@@ -83,9 +78,26 @@ class ClusterTest extends Notification {
/**
* Returns the generated JMS message id. for the reply.
*
* @return The generated JMS message id. for the reply.
* @return The generated JMS message id. for the reply.
*/
public String getReplyMsgId() {
return replyMsgId;
}
/**
* Appends a string image for this object to the StringBuffer parameter.
*
* @param output
* buffer to fill in
* @return
* <code>output</code> buffer is returned
*/
public StringBuffer toString(StringBuffer output) {
output.append('(');
super.toString(output);
output.append(",cluster=").append(cluster);
output.append(')');
return output;
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2004 - 2006 ScalAgent Distributed Technologies
* Copyright (C) 2004 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 2004 - France Telecom R&D
*
* This library is free software; you can redistribute it and/or
......@@ -25,15 +25,13 @@ package org.objectweb.joram.mom.notifications;
import fr.dyade.aaa.agent.Notification;
public class QueueClusterNot extends Notification {
public abstract class ClusterLBNot extends Notification {
/**
*
*/
private static final long serialVersionUID = 1L;
private float rateOfFlow;
public QueueClusterNot(float rateOfFlow) {
public ClusterLBNot(float rateOfFlow) {
this.rateOfFlow = rateOfFlow;
}
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2005 - 2006 ScalAgent Distributed Technologies
* Copyright (C) 2005 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 2004 - France Telecom R&D
*
* This library is free software; you can redistribute it and/or
......@@ -23,33 +23,13 @@
*/
package org.objectweb.joram.mom.notifications;
public class LeaveQueueCluster extends QueueClusterNot {
import fr.dyade.aaa.agent.Notification;
public class ClusterRemoveNot extends Notification {
/**
*
*/
private static final long serialVersionUID = 1L;
public String removeQueue;
public LeaveQueueCluster(String removeQueue) {
super(1);
this.removeQueue = removeQueue;
public ClusterRemoveNot() {
}
/**
* Appends a string image for this object to the StringBuffer parameter.
*
* @param output
* buffer to fill in
* @return
<code>output</code> buffer is returned
*/
public StringBuffer toString(StringBuffer output) {
output.append('(');
super.toString(output);
output.append(", removeQueue=").append(removeQueue);
output.append(')');
return output;
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2005 - 2006 ScalAgent Distributed Technologies
* Copyright (C) 2004 - France Telecom R&D
*
* This library 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 any later version.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package org.objectweb.joram.mom.notifications;
import java.util.Hashtable;
public class JoinQueueCluster extends QueueClusterNot {
/**
*
*/
private static final long serialVersionUID = 1L;
public Hashtable clusters;
public Hashtable clients;
public boolean freeReading;
public boolean freeWriting;
public JoinQueueCluster(float rateOfFlow,
Hashtable clusters,
Hashtable clients,
boolean freeReading,
boolean freeWriting) {
super(rateOfFlow);
this.clusters = clusters;
this.clients = clients;
this.freeReading = freeReading;
this.freeWriting = freeWriting;
}
/**
* Appends a string image for this object to the StringBuffer parameter.
*
* @param output
* buffer to fill in
* @return
<code>output</code> buffer is returned
*/
public StringBuffer toString(StringBuffer output) {
output.append('(');
super.toString(output);
output.append(",clusters=").append(clusters);
output.append(",clients=").append(clients);
output.append(",freeReading=").append(freeReading);
output.append(",freeWriting=").append(freeWriting);
output.append(')');
return output;
}
}
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2005 - 2007 ScalAgent Distributed Technologies
* Copyright (C) 2005 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 2004 - France Telecom R&D
*
* This library is free software; you can redistribute it and/or
......@@ -25,15 +25,15 @@ package org.objectweb.joram.mom.notifications;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
public class LBCycleLife extends QueueClusterNot {
public class LBCycleLife extends ClusterLBNot {
/**
*
*/
private static final long serialVersionUID = 1L;
private ClientMessages clientMessages;
private Hashtable visitTable;
private Map visitTable;
/**
*
......@@ -73,7 +73,7 @@ public class LBCycleLife extends QueueClusterNot {
*
* @return visitTable