Search in sources :

Example 16 with AMQPType

use of com.swiftmq.amqp.v100.types.AMQPType in project swiftmq-client by iitsoftware.

the class BeginFrame method decode.

private void decode() throws Exception {
    List l = body.getValue();
    AMQPType t = null;
    int idx = 0;
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            remoteChannel = (AMQPUnsignedShort) t;
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'remoteChannel' in 'Begin' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() == AMQPTypeDecoder.NULL)
        throw new Exception("Mandatory field 'nextOutgoingId' in 'Begin' frame is NULL");
    try {
        nextOutgoingId = new TransferNumber(((AMQPUnsignedInt) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'nextOutgoingId' in 'Begin' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() == AMQPTypeDecoder.NULL)
        throw new Exception("Mandatory field 'incomingWindow' in 'Begin' frame is NULL");
    try {
        incomingWindow = (AMQPUnsignedInt) t;
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'incomingWindow' in 'Begin' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() == AMQPTypeDecoder.NULL)
        throw new Exception("Mandatory field 'outgoingWindow' in 'Begin' frame is NULL");
    try {
        outgoingWindow = (AMQPUnsignedInt) t;
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'outgoingWindow' in 'Begin' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            handleMax = new Handle(((AMQPUnsignedInt) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'handleMax' in 'Begin' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            offeredCapabilities = AMQPTypeDecoder.isArray(t.getCode()) ? (AMQPArray) t : singleToArray(t);
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'offeredCapabilities' in 'Begin' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            desiredCapabilities = AMQPTypeDecoder.isArray(t.getCode()) ? (AMQPArray) t : singleToArray(t);
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'desiredCapabilities' in 'Begin' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            properties = new Fields(((AMQPMap) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'properties' in 'Begin' frame: " + e);
    }
}
Also used : Fields(com.swiftmq.amqp.v100.generated.transport.definitions.Fields) TransferNumber(com.swiftmq.amqp.v100.generated.transport.definitions.TransferNumber) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Handle(com.swiftmq.amqp.v100.generated.transport.definitions.Handle)

Example 17 with AMQPType

use of com.swiftmq.amqp.v100.types.AMQPType in project swiftmq-client by iitsoftware.

the class CloseFrame method decode.

private void decode() throws Exception {
    List l = body.getValue();
    AMQPType t = null;
    int idx = 0;
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            error = new Error(((AMQPList) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'error' in 'Close' frame: " + e);
    }
}
Also used : Error(com.swiftmq.amqp.v100.generated.transport.definitions.Error) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException)

Example 18 with AMQPType

use of com.swiftmq.amqp.v100.types.AMQPType in project swiftmq-client by iitsoftware.

the class DetachFrame method decode.

private void decode() throws Exception {
    List l = body.getValue();
    AMQPType t = null;
    int idx = 0;
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() == AMQPTypeDecoder.NULL)
        throw new Exception("Mandatory field 'handle' in 'Detach' frame is NULL");
    try {
        handle = new Handle(((AMQPUnsignedInt) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'handle' in 'Detach' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            closed = (AMQPBoolean) t;
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'closed' in 'Detach' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            error = new Error(((AMQPList) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'error' in 'Detach' frame: " + e);
    }
}
Also used : Error(com.swiftmq.amqp.v100.generated.transport.definitions.Error) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Handle(com.swiftmq.amqp.v100.generated.transport.definitions.Handle)

Example 19 with AMQPType

use of com.swiftmq.amqp.v100.types.AMQPType in project swiftmq-client by iitsoftware.

the class DispositionFrame method decode.

private void decode() throws Exception {
    List l = body.getValue();
    AMQPType t = null;
    int idx = 0;
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() == AMQPTypeDecoder.NULL)
        throw new Exception("Mandatory field 'role' in 'Disposition' frame is NULL");
    try {
        role = new Role(((AMQPBoolean) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'role' in 'Disposition' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() == AMQPTypeDecoder.NULL)
        throw new Exception("Mandatory field 'first' in 'Disposition' frame is NULL");
    try {
        first = new DeliveryNumber(((AMQPUnsignedInt) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'first' in 'Disposition' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            last = new DeliveryNumber(((AMQPUnsignedInt) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'last' in 'Disposition' frame: " + e);
    }
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            settled = (AMQPBoolean) t;
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'settled' in 'Disposition' frame: " + e);
    }
    // Factory  : DeliveryStateFactory
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    if (t.getCode() != AMQPTypeDecoder.NULL)
        state = DeliveryStateFactory.create(t);
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            batchable = (AMQPBoolean) t;
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'batchable' in 'Disposition' frame: " + e);
    }
}
Also used : Role(com.swiftmq.amqp.v100.generated.transport.definitions.Role) DeliveryNumber(com.swiftmq.amqp.v100.generated.transport.definitions.DeliveryNumber) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException)

Example 20 with AMQPType

use of com.swiftmq.amqp.v100.types.AMQPType in project swiftmq-client by iitsoftware.

the class EndFrame method decode.

private void decode() throws Exception {
    List l = body.getValue();
    AMQPType t = null;
    int idx = 0;
    // Factory  : ./.
    if (idx >= l.size())
        return;
    t = (AMQPType) l.get(idx++);
    try {
        if (t.getCode() != AMQPTypeDecoder.NULL)
            error = new Error(((AMQPList) t).getValue());
    } catch (ClassCastException e) {
        throw new Exception("Invalid type of field 'error' in 'End' frame: " + e);
    }
}
Also used : Error(com.swiftmq.amqp.v100.generated.transport.definitions.Error) List(java.util.List) ArrayList(java.util.ArrayList) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)20 List (java.util.List)14 ArrayList (java.util.ArrayList)13 Map (java.util.Map)6 Iterator (java.util.Iterator)5 AmqpValue (com.swiftmq.amqp.v100.generated.messaging.message_format.AmqpValue)4 Error (com.swiftmq.amqp.v100.generated.transport.definitions.Error)4 Fields (com.swiftmq.amqp.v100.generated.transport.definitions.Fields)4 AMQPMessage (com.swiftmq.amqp.v100.messaging.AMQPMessage)4 Handle (com.swiftmq.amqp.v100.generated.transport.definitions.Handle)3 SequenceNo (com.swiftmq.amqp.v100.generated.transport.definitions.SequenceNo)3 AMQPType (com.swiftmq.amqp.v100.types.AMQPType)3 AMQPException (com.swiftmq.amqp.v100.client.AMQPException)2 AddressString (com.swiftmq.amqp.v100.generated.messaging.message_format.AddressString)2 Coordinator (com.swiftmq.amqp.v100.generated.transactions.coordination.Coordinator)2 Declared (com.swiftmq.amqp.v100.generated.transactions.coordination.Declared)2 Milliseconds (com.swiftmq.amqp.v100.generated.transport.definitions.Milliseconds)2 Seconds (com.swiftmq.amqp.v100.generated.transport.definitions.Seconds)2 TransferNumber (com.swiftmq.amqp.v100.generated.transport.definitions.TransferNumber)2 AMQPString (com.swiftmq.amqp.v100.types.AMQPString)2