http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/CreateSharedQueueMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/CreateSharedQueueMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/CreateSharedQueueMessage.java new file mode 100644 index 0000000..12339e6 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/CreateSharedQueueMessage.java @@ -0,0 +1,180 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.api.core.SimpleString; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + + */ +public class CreateSharedQueueMessage extends PacketImpl +{ + + private SimpleString address; + + private SimpleString queueName; + + private SimpleString filterString; + + private boolean durable; + + private boolean requiresResponse; + + public CreateSharedQueueMessage(final SimpleString address, + final SimpleString queueName, + final SimpleString filterString, + final boolean durable, + final boolean requiresResponse) + { + this(); + + this.address = address; + this.queueName = queueName; + this.filterString = filterString; + this.durable = durable; + this.requiresResponse = requiresResponse; + } + + public CreateSharedQueueMessage() + { + super(CREATE_SHARED_QUEUE); + } + + // Public -------------------------------------------------------- + + @Override + public String toString() + { + StringBuffer buff = new StringBuffer(getParentString()); + buff.append(", address=" + address); + buff.append(", queueName=" + queueName); + buff.append(", filterString=" + filterString); + buff.append(", durable=" + filterString); + buff.append("]"); + return buff.toString(); + } + + public SimpleString getAddress() + { + return address; + } + + public SimpleString getQueueName() + { + return queueName; + } + + public SimpleString getFilterString() + { + return filterString; + } + + public boolean isRequiresResponse() + { + return requiresResponse; + } + + public void setAddress(SimpleString address) + { + this.address = address; + } + + public void setQueueName(SimpleString queueName) + { + this.queueName = queueName; + } + + public void setFilterString(SimpleString filterString) + { + this.filterString = filterString; + } + + public boolean isDurable() + { + return durable; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeSimpleString(address); + buffer.writeSimpleString(queueName); + buffer.writeNullableSimpleString(filterString); + buffer.writeBoolean(durable); + buffer.writeBoolean(requiresResponse); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + address = buffer.readSimpleString(); + queueName = buffer.readSimpleString(); + filterString = buffer.readNullableSimpleString(); + durable = buffer.readBoolean(); + requiresResponse = buffer.readBoolean(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((address == null) ? 0 : address.hashCode()); + result = prime * result + ((filterString == null) ? 0 : filterString.hashCode()); + result = prime * result + ((queueName == null) ? 0 : queueName.hashCode()); + result = prime * result + (durable ? 1231 : 1237); + result = prime * result + (requiresResponse ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof CreateSharedQueueMessage)) + return false; + CreateSharedQueueMessage other = (CreateSharedQueueMessage)obj; + if (address == null) + { + if (other.address != null) + return false; + } + else if (!address.equals(other.address)) + return false; + if (filterString == null) + { + if (other.filterString != null) + return false; + } + else if (!filterString.equals(other.filterString)) + return false; + if (queueName == null) + { + if (other.queueName != null) + return false; + } + else if (!queueName.equals(other.queueName)) + return false; + if (durable != other.durable) + return false; + if (requiresResponse != other.requiresResponse) + return false; + return true; + } +}
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectConsumerMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectConsumerMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectConsumerMessage.java new file mode 100644 index 0000000..e842bd8 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectConsumerMessage.java @@ -0,0 +1,50 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +public class DisconnectConsumerMessage extends PacketImpl +{ + private long consumerId; + + public DisconnectConsumerMessage(final long consumerId) + { + super(DISCONNECT_CONSUMER); + this.consumerId = consumerId; + } + + public DisconnectConsumerMessage() + { + super(DISCONNECT_CONSUMER); + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeLong(consumerId); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + consumerId = buffer.readLong(); + } + + public long getConsumerId() + { + return consumerId; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectMessage.java new file mode 100644 index 0000000..12ba174 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectMessage.java @@ -0,0 +1,120 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.api.core.SimpleString; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +public class DisconnectMessage extends PacketImpl +{ + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + protected SimpleString nodeID; + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public DisconnectMessage(final SimpleString nodeID) + { + super(DISCONNECT); + + this.nodeID = nodeID; + } + + public DisconnectMessage() + { + super(DISCONNECT); + } + + public DisconnectMessage(byte disconnectV2) + { + super(disconnectV2); + } + + // Public -------------------------------------------------------- + + public SimpleString getNodeID() + { + return nodeID; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeNullableSimpleString(nodeID); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + nodeID = buffer.readNullableSimpleString(); + } + + @Override + public String toString() + { + StringBuffer buf = new StringBuffer(getParentString()); + buf.append(", nodeID=" + nodeID); + buf.append("]"); + return buf.toString(); + } + + @Override + public final boolean isRequiresConfirmations() + { + return false; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((nodeID == null) ? 0 : nodeID.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (!super.equals(obj)) + { + return false; + } + if (!(obj instanceof DisconnectMessage)) + { + return false; + } + DisconnectMessage other = (DisconnectMessage)obj; + if (nodeID == null) + { + if (other.nodeID != null) + { + return false; + } + } + else if (!nodeID.equals(other.nodeID)) + { + return false; + } + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectMessage_V2.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectMessage_V2.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectMessage_V2.java new file mode 100644 index 0000000..a2714be --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/DisconnectMessage_V2.java @@ -0,0 +1,105 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.api.core.SimpleString; + +public class DisconnectMessage_V2 extends DisconnectMessage +{ + private SimpleString scaleDownNodeID; + + public DisconnectMessage_V2(final SimpleString nodeID, final String scaleDownNodeID) + { + super(DISCONNECT_V2); + + this.nodeID = nodeID; + + this.scaleDownNodeID = SimpleString.toSimpleString(scaleDownNodeID); + } + + public DisconnectMessage_V2() + { + super(DISCONNECT_V2); + } + + // Public -------------------------------------------------------- + + public SimpleString getScaleDownNodeID() + { + return scaleDownNodeID; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + super.encodeRest(buffer); + buffer.writeNullableSimpleString(scaleDownNodeID); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + super.decodeRest(buffer); + scaleDownNodeID = buffer.readNullableSimpleString(); + } + + @Override + public String toString() + { + StringBuffer buf = new StringBuffer(getParentString()); + buf.append(", nodeID=" + nodeID); + buf.append(", scaleDownNodeID=" + scaleDownNodeID); + buf.append("]"); + return buf.toString(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((scaleDownNodeID == null) ? 0 : scaleDownNodeID.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (!super.equals(obj)) + { + return false; + } + if (!(obj instanceof DisconnectMessage_V2)) + { + return false; + } + DisconnectMessage_V2 other = (DisconnectMessage_V2) obj; + if (scaleDownNodeID == null) + { + if (other.scaleDownNodeID != null) + { + return false; + } + } + else if (!scaleDownNodeID.equals(other.scaleDownNodeID)) + { + return false; + } + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java new file mode 100644 index 0000000..ab6fe23 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java @@ -0,0 +1,118 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.api.core.HornetQException; +import org.apache.activemq6.api.core.HornetQExceptionType; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Jeff Mesnil</a> + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public class HornetQExceptionMessage extends PacketImpl +{ + + private HornetQException exception; + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public HornetQExceptionMessage(final HornetQException exception) + { + super(EXCEPTION); + + this.exception = exception; + } + + public HornetQExceptionMessage() + { + super(EXCEPTION); + } + + // Public -------------------------------------------------------- + + @Override + public boolean isResponse() + { + return true; + } + + public HornetQException getException() + { + return exception; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeInt(exception.getType().getCode()); + buffer.writeNullableString(exception.getMessage()); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + int code = buffer.readInt(); + String msg = buffer.readNullableString(); + + exception = HornetQExceptionType.createException(code, msg); + } + + @Override + public String toString() + { + return getParentString() + ", exception= " + exception + "]"; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((exception == null) ? 0 : exception.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (!super.equals(obj)) + { + return false; + } + if (!(obj instanceof HornetQExceptionMessage)) + { + return false; + } + HornetQExceptionMessage other = (HornetQExceptionMessage)obj; + if (exception == null) + { + if (other.exception != null) + { + return false; + } + } + else if (!exception.equals(other.exception)) + { + return false; + } + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/MessagePacket.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/MessagePacket.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/MessagePacket.java new file mode 100644 index 0000000..a9c4b31 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/MessagePacket.java @@ -0,0 +1,42 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.Message; +import org.apache.activemq6.core.message.impl.MessageInternal; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * A MessagePacket + * + * @author Tim Fox + * + * + */ +public abstract class MessagePacket extends PacketImpl +{ + protected MessageInternal message; + + public MessagePacket(final byte type, final MessageInternal message) + { + super(type); + + this.message = message; + } + + public Message getMessage() + { + return message; + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/NullResponseMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/NullResponseMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/NullResponseMessage.java new file mode 100644 index 0000000..474f53d --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/NullResponseMessage.java @@ -0,0 +1,33 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public class NullResponseMessage extends PacketImpl +{ + + public NullResponseMessage() + { + super(NULL_RESPONSE); + } + + @Override + public boolean isResponse() + { + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java new file mode 100644 index 0000000..8eb088d --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java @@ -0,0 +1,105 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * + * A PacketsConfirmedMessage + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + * + */ +public class PacketsConfirmedMessage extends PacketImpl +{ + + private int commandID; + + public PacketsConfirmedMessage(final int commandID) + { + super(PACKETS_CONFIRMED); + + this.commandID = commandID; + } + + public PacketsConfirmedMessage() + { + super(PACKETS_CONFIRMED); + } + + // Public -------------------------------------------------------- + + public int getCommandID() + { + return commandID; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeInt(commandID); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + commandID = buffer.readInt(); + } + + + @Override + public final boolean isRequiresConfirmations() + { + return false; + } + + @Override + public String toString() + { + return getParentString() + ", commandID=" + commandID + "]"; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + commandID; + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (!super.equals(obj)) + { + return false; + } + if (!(obj instanceof PacketsConfirmedMessage)) + { + return false; + } + PacketsConfirmedMessage other = (PacketsConfirmedMessage)obj; + if (commandID != other.commandID) + { + return false; + } + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/Ping.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/Ping.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/Ping.java new file mode 100644 index 0000000..f2ce2a3 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/Ping.java @@ -0,0 +1,103 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * Ping is sent on the client side by {@link org.apache.activemq6.core.client.impl.ClientSessionFactoryImpl}. At the server's + * side it is handled by {@link org.apache.activemq6.core.remoting.server.impl.RemotingServiceImpl} + * @see org.apache.activemq6.spi.core.protocol.RemotingConnection#checkDataReceived() + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public final class Ping extends PacketImpl +{ + private long connectionTTL; + + public Ping(final long connectionTTL) + { + super(PING); + + this.connectionTTL = connectionTTL; + } + + public Ping() + { + super(PING); + } + + public long getConnectionTTL() + { + return connectionTTL; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeLong(connectionTTL); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + connectionTTL = buffer.readLong(); + } + + @Override + public boolean isRequiresConfirmations() + { + return false; + } + + @Override + public String toString() + { + StringBuffer buf = new StringBuffer(getParentString()); + buf.append(", connectionTTL=" + connectionTTL); + buf.append("]"); + return buf.toString(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (int)(connectionTTL ^ (connectionTTL >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (!super.equals(obj)) + { + return false; + } + if (!(obj instanceof Ping)) + { + return false; + } + Ping other = (Ping)obj; + if (connectionTTL != other.connectionTTL) + { + return false; + } + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/ReattachSessionMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/ReattachSessionMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/ReattachSessionMessage.java new file mode 100644 index 0000000..0e47ac5 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/ReattachSessionMessage.java @@ -0,0 +1,106 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * + * A ReattachSessionMessage + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + * + */ +public class ReattachSessionMessage extends PacketImpl +{ + private String name; + + private int lastConfirmedCommandID; + + public ReattachSessionMessage(final String name, final int lastConfirmedCommandID) + { + super(REATTACH_SESSION); + + this.name = name; + + this.lastConfirmedCommandID = lastConfirmedCommandID; + } + + public ReattachSessionMessage() + { + super(REATTACH_SESSION); + } + + public String getName() + { + return name; + } + + public int getLastConfirmedCommandID() + { + return lastConfirmedCommandID; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeString(name); + buffer.writeInt(lastConfirmedCommandID); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + name = buffer.readString(); + lastConfirmedCommandID = buffer.readInt(); + } + + @Override + public final boolean isRequiresConfirmations() + { + return false; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + lastConfirmedCommandID; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof ReattachSessionMessage)) + return false; + ReattachSessionMessage other = (ReattachSessionMessage)obj; + if (lastConfirmedCommandID != other.lastConfirmedCommandID) + return false; + if (name == null) + { + if (other.name != null) + return false; + } + else if (!name.equals(other.name)) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java new file mode 100644 index 0000000..81ed8ea --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java @@ -0,0 +1,109 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * + * A ReattachSessionResponseMessage + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + * + */ +public class ReattachSessionResponseMessage extends PacketImpl +{ + private int lastConfirmedCommandID; + + private boolean reattached; + + public ReattachSessionResponseMessage(final int lastConfirmedCommandID, final boolean reattached) + { + super(REATTACH_SESSION_RESP); + + this.lastConfirmedCommandID = lastConfirmedCommandID; + + this.reattached = reattached; + } + + public ReattachSessionResponseMessage() + { + super(REATTACH_SESSION_RESP); + } + + // Public -------------------------------------------------------- + + public int getLastConfirmedCommandID() + { + return lastConfirmedCommandID; + } + + public boolean isReattached() + { + return reattached; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeInt(lastConfirmedCommandID); + buffer.writeBoolean(reattached); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + lastConfirmedCommandID = buffer.readInt(); + reattached = buffer.readBoolean(); + } + + @Override + public boolean isResponse() + { + return true; + } + + @Override + public final boolean isRequiresConfirmations() + { + return false; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + lastConfirmedCommandID; + result = prime * result + (reattached ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof ReattachSessionResponseMessage)) + return false; + ReattachSessionResponseMessage other = (ReattachSessionResponseMessage)obj; + if (lastConfirmedCommandID != other.lastConfirmedCommandID) + return false; + if (reattached != other.reattached) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/RollbackMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/RollbackMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/RollbackMessage.java new file mode 100644 index 0000000..7c00bfc --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/RollbackMessage.java @@ -0,0 +1,97 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * A RollbackMessage + * @author <a href="mailto:[email protected]">Clebert Suconic</a> + */ +public class RollbackMessage extends PacketImpl +{ + + public RollbackMessage() + { + super(SESS_ROLLBACK); + } + + public RollbackMessage(final boolean considerLastMessageAsDelivered) + { + super(SESS_ROLLBACK); + + this.considerLastMessageAsDelivered = considerLastMessageAsDelivered; + } + + + private boolean considerLastMessageAsDelivered; + + /** + * @return the considerLastMessageAsDelivered + */ + public boolean isConsiderLastMessageAsDelivered() + { + return considerLastMessageAsDelivered; + } + + /** + * @param isLastMessageAsDelivered the considerLastMessageAsDelivered to set + */ + public void setConsiderLastMessageAsDelivered(final boolean isLastMessageAsDelivered) + { + considerLastMessageAsDelivered = isLastMessageAsDelivered; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeBoolean(considerLastMessageAsDelivered); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + considerLastMessageAsDelivered = buffer.readBoolean(); + } + + @Override + public boolean isAsyncExec() + { + return true; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (considerLastMessageAsDelivered ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof RollbackMessage)) + return false; + RollbackMessage other = (RollbackMessage)obj; + if (considerLastMessageAsDelivered != other.considerLastMessageAsDelivered) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java new file mode 100644 index 0000000..1a0a4bb --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java @@ -0,0 +1,111 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public class SessionAcknowledgeMessage extends PacketImpl +{ + private long consumerID; + + private long messageID; + + private boolean requiresResponse; + + public SessionAcknowledgeMessage(final long consumerID, final long messageID, final boolean requiresResponse) + { + super(SESS_ACKNOWLEDGE); + + this.consumerID = consumerID; + + this.messageID = messageID; + + this.requiresResponse = requiresResponse; + } + + public SessionAcknowledgeMessage() + { + super(SESS_ACKNOWLEDGE); + } + + // Public -------------------------------------------------------- + + public long getConsumerID() + { + return consumerID; + } + + public long getMessageID() + { + return messageID; + } + + public boolean isRequiresResponse() + { + return requiresResponse; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeLong(consumerID); + + buffer.writeLong(messageID); + + buffer.writeBoolean(requiresResponse); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + consumerID = buffer.readLong(); + + messageID = buffer.readLong(); + + requiresResponse = buffer.readBoolean(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (int)(consumerID ^ (consumerID >>> 32)); + result = prime * result + (int)(messageID ^ (messageID >>> 32)); + result = prime * result + (requiresResponse ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionAcknowledgeMessage)) + return false; + SessionAcknowledgeMessage other = (SessionAcknowledgeMessage)obj; + if (consumerID != other.consumerID) + return false; + if (messageID != other.messageID) + return false; + if (requiresResponse != other.requiresResponse) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAddMetaDataMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAddMetaDataMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAddMetaDataMessage.java new file mode 100644 index 0000000..2ab3296 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAddMetaDataMessage.java @@ -0,0 +1,111 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * A SessionAddMetaDataMessage + * + * Packet deprecated: It exists only to support old formats + * + * @author <a href="mailto:[email protected]">Howard Gao</a> + * + * + */ +public class SessionAddMetaDataMessage extends PacketImpl +{ + private String key; + private String data; + + public SessionAddMetaDataMessage() + { + super(SESS_ADD_METADATA); + } + + public SessionAddMetaDataMessage(String k, String d) + { + this(); + key = k; + data = d; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeString(key); + buffer.writeString(data); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + key = buffer.readString(); + data = buffer.readString(); + } + + @Override + public final boolean isRequiresConfirmations() + { + return false; + } + + public String getKey() + { + return key; + } + + public String getData() + { + return data; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((data == null) ? 0 : data.hashCode()); + result = prime * result + ((key == null) ? 0 : key.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionAddMetaDataMessage)) + return false; + SessionAddMetaDataMessage other = (SessionAddMetaDataMessage)obj; + if (data == null) + { + if (other.data != null) + return false; + } + else if (!data.equals(other.data)) + return false; + if (key == null) + { + if (other.key != null) + return false; + } + else if (!key.equals(other.key)) + return false; + return true; + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAddMetaDataMessageV2.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAddMetaDataMessageV2.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAddMetaDataMessageV2.java new file mode 100644 index 0000000..070bda0 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionAddMetaDataMessageV2.java @@ -0,0 +1,140 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * A SessionAddMetaDataMessage + * + * This packet replaces {@link SessionAddMetaDataMessage} + * + * @author Clebert Suconic + * + * + */ +public class SessionAddMetaDataMessageV2 extends PacketImpl +{ + private String key; + private String data; + /** + * It's not required confirmation during failover / reconnect + */ + private boolean requiresConfirmation = true; + + public SessionAddMetaDataMessageV2() + { + super(SESS_ADD_METADATA2); + } + + protected SessionAddMetaDataMessageV2(byte packetCode) + { + super(packetCode); + } + + public SessionAddMetaDataMessageV2(String k, String d) + { + this(); + key = k; + data = d; + } + + protected SessionAddMetaDataMessageV2(final byte packetCode, String k, String d) + { + super(packetCode); + key = k; + data = d; + } + + public SessionAddMetaDataMessageV2(String k, String d, boolean requiresConfirmation) + { + this(); + key = k; + data = d; + this.requiresConfirmation = requiresConfirmation; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeString(key); + buffer.writeString(data); + buffer.writeBoolean(requiresConfirmation); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + key = buffer.readString(); + data = buffer.readString(); + requiresConfirmation = buffer.readBoolean(); + } + + @Override + public final boolean isRequiresConfirmations() + { + return requiresConfirmation; + } + + public String getKey() + { + return key; + } + + public String getData() + { + return data; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((data == null) ? 0 : data.hashCode()); + result = prime * result + ((key == null) ? 0 : key.hashCode()); + result = prime * result + (requiresConfirmation ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionAddMetaDataMessageV2)) + return false; + SessionAddMetaDataMessageV2 other = (SessionAddMetaDataMessageV2)obj; + if (data == null) + { + if (other.data != null) + return false; + } + else if (!data.equals(other.data)) + return false; + if (key == null) + { + if (other.key != null) + return false; + } + else if (!key.equals(other.key)) + return false; + if (requiresConfirmation != other.requiresConfirmation) + return false; + return true; + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java new file mode 100644 index 0000000..5d113e7 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java @@ -0,0 +1,87 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.api.core.SimpleString; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * + * A SessionQueueQueryMessage + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + * + */ +public class SessionBindingQueryMessage extends PacketImpl +{ + private SimpleString address; + + public SessionBindingQueryMessage(final SimpleString address) + { + super(SESS_BINDINGQUERY); + + this.address = address; + } + + public SessionBindingQueryMessage() + { + super(SESS_BINDINGQUERY); + } + + public SimpleString getAddress() + { + return address; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeSimpleString(address); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + address = buffer.readSimpleString(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((address == null) ? 0 : address.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionBindingQueryMessage)) + return false; + SessionBindingQueryMessage other = (SessionBindingQueryMessage)obj; + if (address == null) + { + if (other.address != null) + return false; + } + else if (!address.equals(other.address)) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java new file mode 100644 index 0000000..9db8727 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java @@ -0,0 +1,119 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.api.core.SimpleString; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * + * A SessionBindingQueryResponseMessage + * + * @author <a href="mailto:[email protected]">Tim Fox</a> + * + */ +public class SessionBindingQueryResponseMessage extends PacketImpl +{ + private boolean exists; + + private List<SimpleString> queueNames; + + public SessionBindingQueryResponseMessage(final boolean exists, final List<SimpleString> queueNames) + { + super(SESS_BINDINGQUERY_RESP); + + this.exists = exists; + + this.queueNames = queueNames; + } + + public SessionBindingQueryResponseMessage() + { + super(SESS_BINDINGQUERY_RESP); + } + + @Override + public boolean isResponse() + { + return true; + } + + public boolean isExists() + { + return exists; + } + + public List<SimpleString> getQueueNames() + { + return queueNames; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeBoolean(exists); + buffer.writeInt(queueNames.size()); + for (SimpleString queueName : queueNames) + { + buffer.writeSimpleString(queueName); + } + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + exists = buffer.readBoolean(); + int numQueues = buffer.readInt(); + queueNames = new ArrayList<SimpleString>(numQueues); + for (int i = 0; i < numQueues; i++) + { + queueNames.add(buffer.readSimpleString()); + } + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (exists ? 1231 : 1237); + result = prime * result + ((queueNames == null) ? 0 : queueNames.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionBindingQueryResponseMessage)) + return false; + SessionBindingQueryResponseMessage other = (SessionBindingQueryResponseMessage)obj; + if (exists != other.exists) + return false; + if (queueNames == null) + { + if (other.queueNames != null) + return false; + } + else if (!queueNames.equals(other.queueNames)) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCloseMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCloseMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCloseMessage.java new file mode 100644 index 0000000..7aaac80 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCloseMessage.java @@ -0,0 +1,54 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public class SessionCloseMessage extends PacketImpl +{ + + + public SessionCloseMessage() + { + super(SESS_CLOSE); + } + + // Public -------------------------------------------------------- + + @Override + public boolean equals(final Object other) + { + if (other instanceof SessionCloseMessage == false) + { + return false; + } + + return super.equals(other); + } + + @Override + public int hashCode() + { + // TODO + return 0; + } + + @Override + public boolean isAsyncExec() + { + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCommitMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCommitMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCommitMessage.java new file mode 100644 index 0000000..4816999 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCommitMessage.java @@ -0,0 +1,34 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * A SessionCommitMessage + * @author tim + */ +public class SessionCommitMessage extends PacketImpl +{ + + public SessionCommitMessage() + { + super(SESS_COMMIT); + } + + @Override + public boolean isAsyncExec() + { + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java new file mode 100644 index 0000000..a4fcfec --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java @@ -0,0 +1,86 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public class SessionConsumerCloseMessage extends PacketImpl +{ + + private long consumerID; + + public SessionConsumerCloseMessage(final long objectID) + { + super(SESS_CONSUMER_CLOSE); + + consumerID = objectID; + } + + public SessionConsumerCloseMessage() + { + super(SESS_CONSUMER_CLOSE); + } + + // Public -------------------------------------------------------- + + public long getConsumerID() + { + return consumerID; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeLong(consumerID); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + consumerID = buffer.readLong(); + } + + @Override + public String toString() + { + return getParentString() + ", consumerID=" + consumerID + "]"; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (int)(consumerID ^ (consumerID >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionConsumerCloseMessage)) + return false; + SessionConsumerCloseMessage other = (SessionConsumerCloseMessage)obj; + if (consumerID != other.consumerID) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java new file mode 100644 index 0000000..7bea576 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java @@ -0,0 +1,98 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + * @author <a href="mailto:[email protected]">Jeff Mesnil</a>. + * + */ +public class SessionConsumerFlowCreditMessage extends PacketImpl +{ + private long consumerID; + private int credits; + + public SessionConsumerFlowCreditMessage(final long consumerID, final int credits) + { + super(SESS_FLOWTOKEN); + this.consumerID = consumerID; + this.credits = credits; + } + + public SessionConsumerFlowCreditMessage() + { + super(SESS_FLOWTOKEN); + } + + // Public -------------------------------------------------------- + + public long getConsumerID() + { + return consumerID; + } + + public int getCredits() + { + return credits; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeLong(consumerID); + buffer.writeInt(credits); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + consumerID = buffer.readLong(); + credits = buffer.readInt(); + } + + @Override + public String toString() + { + return getParentString() + ", consumerID=" + consumerID + ", credits=" + credits + "]"; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (int)(consumerID ^ (consumerID >>> 32)); + result = prime * result + credits; + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionConsumerFlowCreditMessage)) + return false; + SessionConsumerFlowCreditMessage other = (SessionConsumerFlowCreditMessage)obj; + if (consumerID != other.consumerID) + return false; + if (credits != other.credits) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionContinuationMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionContinuationMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionContinuationMessage.java new file mode 100644 index 0000000..433cfef --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionContinuationMessage.java @@ -0,0 +1,121 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import java.util.Arrays; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; +import org.apache.activemq6.utils.DataConstants; + +/** + * A SessionContinuationMessage + * + * @author <a href="mailto:[email protected]">Clebert Suconic</a> + * + * Created Dec 5, 2008 10:08:40 AM + * + * + */ +public abstract class SessionContinuationMessage extends PacketImpl +{ + + public static final int SESSION_CONTINUATION_BASE_SIZE = PACKET_HEADERS_SIZE + DataConstants.SIZE_INT + + DataConstants.SIZE_BOOLEAN; + + protected byte[] body; + + protected boolean continues; + + public SessionContinuationMessage(final byte type, final byte[] body, final boolean continues) + { + super(type); + this.body = body; + this.continues = continues; + } + + public SessionContinuationMessage(final byte type) + { + super(type); + } + + // Public -------------------------------------------------------- + + /** + * @return the body + */ + public byte[] getBody() + { + if (size <= 0) + { + return new byte[0]; + } + else + { + return body; + } + } + + /** + * @return the continues + */ + public boolean isContinues() + { + return continues; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeInt(body.length); + buffer.writeBytes(body); + buffer.writeBoolean(continues); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + int size = buffer.readInt(); + body = new byte[size]; + buffer.readBytes(body); + continues = buffer.readBoolean(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + Arrays.hashCode(body); + result = prime * result + (continues ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionContinuationMessage)) + return false; + SessionContinuationMessage other = (SessionContinuationMessage)obj; + if (!Arrays.equals(body, other.body)) + return false; + if (continues != other.continues) + return false; + return true; + } + +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java new file mode 100644 index 0000000..7ba0b85 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java @@ -0,0 +1,170 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.api.core.SimpleString; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public class SessionCreateConsumerMessage extends PacketImpl +{ + + private long id; + + private SimpleString queueName; + + private SimpleString filterString; + + private boolean browseOnly; + + private boolean requiresResponse; + + public SessionCreateConsumerMessage(final long id, + final SimpleString queueName, + final SimpleString filterString, + final boolean browseOnly, + final boolean requiresResponse) + { + super(SESS_CREATECONSUMER); + + this.id = id; + this.queueName = queueName; + this.filterString = filterString; + this.browseOnly = browseOnly; + this.requiresResponse = requiresResponse; + } + + public SessionCreateConsumerMessage() + { + super(SESS_CREATECONSUMER); + } + + @Override + public String toString() + { + StringBuffer buff = new StringBuffer(getParentString()); + buff.append(", queueName=" + queueName); + buff.append(", filterString=" + filterString); + buff.append("]"); + return buff.toString(); + } + + public long getID() + { + return id; + } + + public SimpleString getQueueName() + { + return queueName; + } + + public SimpleString getFilterString() + { + return filterString; + } + + public boolean isBrowseOnly() + { + return browseOnly; + } + + public boolean isRequiresResponse() + { + return requiresResponse; + } + + public void setQueueName(SimpleString queueName) + { + this.queueName = queueName; + } + + public void setFilterString(SimpleString filterString) + { + this.filterString = filterString; + } + + public void setBrowseOnly(boolean browseOnly) + { + this.browseOnly = browseOnly; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeLong(id); + buffer.writeSimpleString(queueName); + buffer.writeNullableSimpleString(filterString); + buffer.writeBoolean(browseOnly); + buffer.writeBoolean(requiresResponse); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + id = buffer.readLong(); + queueName = buffer.readSimpleString(); + filterString = buffer.readNullableSimpleString(); + browseOnly = buffer.readBoolean(); + requiresResponse = buffer.readBoolean(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (browseOnly ? 1231 : 1237); + result = prime * result + ((filterString == null) ? 0 : filterString.hashCode()); + result = prime * result + (int)(id ^ (id >>> 32)); + result = prime * result + ((queueName == null) ? 0 : queueName.hashCode()); + result = prime * result + (requiresResponse ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionCreateConsumerMessage)) + return false; + SessionCreateConsumerMessage other = (SessionCreateConsumerMessage)obj; + if (browseOnly != other.browseOnly) + return false; + if (filterString == null) + { + if (other.filterString != null) + return false; + } + else if (!filterString.equals(other.filterString)) + return false; + if (id != other.id) + return false; + if (queueName == null) + { + if (other.queueName != null) + return false; + } + else if (!queueName.equals(other.queueName)) + return false; + if (requiresResponse != other.requiresResponse) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java new file mode 100644 index 0000000..088aefe --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.api.core.SimpleString; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + + */ +public class SessionDeleteQueueMessage extends PacketImpl +{ + private SimpleString queueName; + + public SessionDeleteQueueMessage(final SimpleString queueName) + { + super(DELETE_QUEUE); + + this.queueName = queueName; + } + + public SessionDeleteQueueMessage() + { + super(DELETE_QUEUE); + } + + @Override + public String toString() + { + StringBuffer buff = new StringBuffer(getParentString()); + buff.append(", queueName=" + queueName); + buff.append("]"); + return buff.toString(); + } + + public SimpleString getQueueName() + { + return queueName; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeSimpleString(queueName); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + queueName = buffer.readSimpleString(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((queueName == null) ? 0 : queueName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionDeleteQueueMessage)) + return false; + SessionDeleteQueueMessage other = (SessionDeleteQueueMessage)obj; + if (queueName == null) + { + if (other.queueName != null) + return false; + } + else if (!queueName.equals(other.queueName)) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionExpireMessage.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionExpireMessage.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionExpireMessage.java new file mode 100644 index 0000000..234ff58 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionExpireMessage.java @@ -0,0 +1,103 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * @author <a href="mailto:[email protected]">Tim Fox</a> + */ +public class SessionExpireMessage extends PacketImpl +{ + // Constants ----------------------------------------------------- + + // Attributes ---------------------------------------------------- + + private long consumerID; + + private long messageID; + + // Static -------------------------------------------------------- + + // Constructors -------------------------------------------------- + + public SessionExpireMessage(final long consumerID, final long messageID) + { + super(SESS_EXPIRED); + + this.consumerID = consumerID; + + this.messageID = messageID; + } + + public SessionExpireMessage() + { + super(SESS_EXPIRED); + } + + // Public -------------------------------------------------------- + + public long getConsumerID() + { + return consumerID; + } + + public long getMessageID() + { + return messageID; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeLong(consumerID); + + buffer.writeLong(messageID); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + consumerID = buffer.readLong(); + + messageID = buffer.readLong(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (int)(consumerID ^ (consumerID >>> 32)); + result = prime * result + (int)(messageID ^ (messageID >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionExpireMessage)) + return false; + SessionExpireMessage other = (SessionExpireMessage)obj; + if (consumerID != other.consumerID) + return false; + if (messageID != other.messageID) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java ---------------------------------------------------------------------- diff --git a/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java new file mode 100644 index 0000000..c9b9d54 --- /dev/null +++ b/activemq6-core-client/src/main/java/org/apache/activemq6/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java @@ -0,0 +1,104 @@ +/* + * 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.apache.activemq6.core.protocol.core.impl.wireformat; + +import org.apache.activemq6.api.core.HornetQBuffer; +import org.apache.activemq6.core.protocol.core.impl.PacketImpl; + +/** + * + * A SessionConsumerForceDelivery + * + * @author <a href="mailto:[email protected]">Jeff Mesnil</a> + * + */ +public class SessionForceConsumerDelivery extends PacketImpl +{ + private long consumerID; + private long sequence; + + public SessionForceConsumerDelivery(final long consumerID, final long sequence) + { + super(SESS_FORCE_CONSUMER_DELIVERY); + + this.consumerID = consumerID; + this.sequence = sequence; + } + + public SessionForceConsumerDelivery() + { + super(SESS_FORCE_CONSUMER_DELIVERY); + } + + public long getConsumerID() + { + return consumerID; + } + + public long getSequence() + { + return sequence; + } + + @Override + public void encodeRest(final HornetQBuffer buffer) + { + buffer.writeLong(consumerID); + buffer.writeLong(sequence); + } + + @Override + public void decodeRest(final HornetQBuffer buffer) + { + consumerID = buffer.readLong(); + sequence = buffer.readLong(); + } + + @Override + public String toString() + { + StringBuffer buf = new StringBuffer(getParentString()); + buf.append(", consumerID=" + consumerID); + buf.append(", sequence=" + sequence); + buf.append("]"); + return buf.toString(); + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + (int)(consumerID ^ (consumerID >>> 32)); + result = prime * result + (int)(sequence ^ (sequence >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (!(obj instanceof SessionForceConsumerDelivery)) + return false; + SessionForceConsumerDelivery other = (SessionForceConsumerDelivery)obj; + if (consumerID != other.consumerID) + return false; + if (sequence != other.sequence) + return false; + return true; + } + +}
