use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.
the class UpgradeFrom5To6 method upgradeQueues.
private List<String> upgradeQueues(Environment environment, Transaction transaction, final String virtualHostName) {
final List<String> queueNames = new ArrayList<String>();
LOGGER.info("Queues");
if (environment.getDatabaseNames().contains(OLD_QUEUE_DB_NAME)) {
final UpgradeQueueBinding queueBinding = new UpgradeQueueBinding();
CursorOperation queueCursor = new CursorOperation() {
@Override
public void processEntry(Database queueDatabase, Database configuredObjectsDatabase, Transaction transaction, DatabaseEntry key, DatabaseEntry value) {
OldQueueRecord queueRecord = queueBinding.entryToObject(value);
String queueName = queueRecord.getNameShortString().toString();
queueNames.add(queueName);
String owner = queueRecord.getOwner() == null ? null : queueRecord.getOwner().toString();
boolean exclusive = queueRecord.isExclusive();
FieldTable arguments = queueRecord.getArguments();
UUID queueId = UUIDGenerator.generateQueueUUID(queueName, virtualHostName);
UpgradeConfiguredObjectRecord configuredObject = createQueueConfiguredObjectRecord(queueName, owner, exclusive, arguments);
storeConfiguredObjectEntry(configuredObjectsDatabase, queueId, configuredObject, transaction);
}
};
new DatabaseTemplate(environment, OLD_QUEUE_DB_NAME, CONFIGURED_OBJECTS_DB_NAME, transaction).run(queueCursor);
environment.removeDatabase(transaction, OLD_QUEUE_DB_NAME);
LOGGER.info(queueCursor.getRowCount() + " Queue Entries");
}
return queueNames;
}
use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.
the class BasicConsumeBody method process.
public static void process(final QpidByteBuffer buffer, final ServerChannelMethodProcessor dispatcher) throws AMQFrameDecodingException {
int ticket = buffer.getUnsignedShort();
AMQShortString queue = AMQShortString.readAMQShortString(buffer);
AMQShortString consumerTag = AMQShortString.readAMQShortString(buffer);
byte bitfield = buffer.get();
boolean noLocal = (bitfield & 0x01) == 0x01;
boolean noAck = (bitfield & 0x02) == 0x02;
boolean exclusive = (bitfield & 0x04) == 0x04;
boolean nowait = (bitfield & 0x08) == 0x08;
FieldTable arguments = EncodingUtils.readFieldTable(buffer);
if (!dispatcher.ignoreAllButCloseOk()) {
dispatcher.receiveBasicConsume(queue, consumerTag, noLocal, noAck, exclusive, nowait, arguments);
}
if (arguments != null) {
arguments.clearEncodedForm();
}
}
use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.
the class BasicContentHeaderProperties method decode.
private void decode(QpidByteBuffer buffer) throws AMQFrameDecodingException {
if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0) {
_contentType = AMQShortString.readAMQShortString(buffer);
}
if ((_propertyFlags & ENCODING_MASK) != 0) {
_encoding = AMQShortString.readAMQShortString(buffer);
}
if ((_propertyFlags & HEADERS_MASK) != 0) {
long length = buffer.getUnsignedInt();
try (QpidByteBuffer buf = buffer.view(0, (int) length)) {
_headers = new FieldTable(buf);
}
buffer.position(buffer.position() + (int) length);
}
if ((_propertyFlags & DELIVERY_MODE_MASK) != 0) {
_deliveryMode = buffer.get();
}
if ((_propertyFlags & PRIORITY_MASK) != 0) {
_priority = buffer.get();
}
if ((_propertyFlags & CORRELATION_ID_MASK) != 0) {
_correlationId = AMQShortString.readAMQShortString(buffer);
}
if ((_propertyFlags & REPLY_TO_MASK) != 0) {
_replyTo = AMQShortString.readAMQShortString(buffer);
}
if ((_propertyFlags & EXPIRATION_MASK) != 0) {
_expiration = EncodingUtils.readLongAsShortString(buffer);
}
if ((_propertyFlags & MESSAGE_ID_MASK) != 0) {
_messageId = AMQShortString.readAMQShortString(buffer);
}
if ((_propertyFlags & TIMESTAMP_MASK) != 0) {
_timestamp = buffer.getLong();
}
if ((_propertyFlags & TYPE_MASK) != 0) {
_type = AMQShortString.readAMQShortString(buffer);
}
if ((_propertyFlags & USER_ID_MASK) != 0) {
_userId = AMQShortString.readAMQShortString(buffer);
}
if ((_propertyFlags & APPLICATION_ID_MASK) != 0) {
_appId = AMQShortString.readAMQShortString(buffer);
}
if ((_propertyFlags & CLUSTER_ID_MASK) != 0) {
_clusterId = AMQShortString.readAMQShortString(buffer);
}
}
use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.
the class ChannelAlertBody method process.
public static void process(final QpidByteBuffer buffer, final ClientChannelMethodProcessor dispatcher) throws AMQFrameDecodingException {
int replyCode = buffer.getUnsignedShort();
AMQShortString replyText = AMQShortString.readAMQShortString(buffer);
FieldTable details = EncodingUtils.readFieldTable(buffer);
if (!dispatcher.ignoreAllButCloseOk()) {
dispatcher.receiveChannelAlert(replyCode, replyText, details);
}
if (details != null) {
details.clearEncodedForm();
}
}
use of org.apache.qpid.server.protocol.v0_8.FieldTable in project qpid-broker-j by apache.
the class ConnectionStartOkBody method process.
public static void process(final QpidByteBuffer in, final ServerMethodProcessor dispatcher) throws AMQFrameDecodingException {
FieldTable clientProperties = EncodingUtils.readFieldTable(in);
AMQShortString mechanism = AMQShortString.readAMQShortString(in);
byte[] response = EncodingUtils.readBytes(in);
AMQShortString locale = AMQShortString.readAMQShortString(in);
if (!dispatcher.ignoreAllButCloseOk()) {
dispatcher.receiveConnectionStartOk(clientProperties, mechanism, response, locale);
}
if (clientProperties != null) {
clientProperties.clearEncodedForm();
}
}
Aggregations