Search in sources :

Example 6 with FieldTable

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;
}
Also used : FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable) ArrayList(java.util.ArrayList) AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) DatabaseEntry(com.sleepycat.je.DatabaseEntry) Transaction(com.sleepycat.je.Transaction) Database(com.sleepycat.je.Database) UUID(java.util.UUID)

Example 7 with FieldTable

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();
    }
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable)

Example 8 with FieldTable

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);
    }
}
Also used : FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable) QpidByteBuffer(org.apache.qpid.server.bytebuffer.QpidByteBuffer)

Example 9 with FieldTable

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();
    }
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable)

Example 10 with FieldTable

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();
    }
}
Also used : AMQShortString(org.apache.qpid.server.protocol.v0_8.AMQShortString) FieldTable(org.apache.qpid.server.protocol.v0_8.FieldTable)

Aggregations

FieldTable (org.apache.qpid.server.protocol.v0_8.FieldTable)20 AMQShortString (org.apache.qpid.server.protocol.v0_8.AMQShortString)19 Database (com.sleepycat.je.Database)5 DatabaseEntry (com.sleepycat.je.DatabaseEntry)5 Transaction (com.sleepycat.je.Transaction)5 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)4 HashMap (java.util.HashMap)3 UUID (java.util.UUID)3 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)3 ArrayList (java.util.ArrayList)2 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)2 MessageConversionException (org.apache.qpid.server.protocol.converter.MessageConversionException)2 DeliveryProperties (org.apache.qpid.server.protocol.v0_10.transport.DeliveryProperties)2 Header (org.apache.qpid.server.protocol.v0_10.transport.Header)2 MessageProperties (org.apache.qpid.server.protocol.v0_10.transport.MessageProperties)2 ReplyTo (org.apache.qpid.server.protocol.v0_10.transport.ReplyTo)2 ContentHeaderBody (org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody)2 LongBinding (com.sleepycat.bind.tuple.LongBinding)1 TupleBinding (com.sleepycat.bind.tuple.TupleBinding)1 TupleOutput (com.sleepycat.bind.tuple.TupleOutput)1