Search in sources :

Example 76 with DataStructure

use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure in project fabric8 by jboss-fuse.

the class OpenWireFormat method tightUnmarshalNestedObject.

public DataStructure tightUnmarshalNestedObject(DataByteArrayInputStream dis, BooleanStream bs) throws IOException {
    if (bs.readBoolean()) {
        byte dataType = dis.readByte();
        DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[dataType & 0xFF];
        if (dsm == null) {
            throw new IOException("Unknown data type: " + dataType);
        }
        DataStructure data = dsm.createObject();
        if (data.isMarshallAware() && bs.readBoolean()) {
            dis.readInt();
            dis.readByte();
            BooleanStream bs2 = new BooleanStream();
            bs2.unmarshal(dis);
            dsm.tightUnmarshal(this, data, dis, bs2);
        // TODO: extract the sequence from the dis and associate it.
        // MarshallAware ma = (MarshallAware)data
        // ma.setCachedMarshalledForm(this, sequence);
        } else {
            dsm.tightUnmarshal(this, data, dis, bs);
        }
        return data;
    } else {
        return null;
    }
}
Also used : DataStructure(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure) IOException(java.io.IOException)

Example 77 with DataStructure

use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure in project fabric8 by jboss-fuse.

the class OpenWireFormat method tightMarshal1.

/**
 * Used by NIO or AIO transports
 */
public int tightMarshal1(Object o, BooleanStream bs) throws IOException {
    int size = 1;
    if (o != null) {
        DataStructure c = (DataStructure) o;
        byte type = c.getDataStructureType();
        DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
        if (dsm == null) {
            throw new IOException("Unknown data type: " + type);
        }
        size += dsm.tightMarshal1(this, c, bs);
        size += bs.marshalledSize();
    }
    return size;
}
Also used : DataStructure(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure) IOException(java.io.IOException)

Aggregations

DataStructure (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure)30 IOException (java.io.IOException)7 Message (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message)6 DataResponse (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataResponse)5 RemoveInfo (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.RemoveInfo)5 BrokerInfo (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.BrokerInfo)3 ConnectionError (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.ConnectionError)3 ConnectionInfo (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.ConnectionInfo)3 ConsumerControl (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.ConsumerControl)3 ConsumerInfo (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.ConsumerInfo)3 DestinationInfo (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DestinationInfo)3 LocalTransactionId (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.LocalTransactionId)3 MessageAck (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.MessageAck)3 MessageDispatch (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.MessageDispatch)3 MessageDispatchNotification (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.MessageDispatchNotification)3 MessageId (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.MessageId)3 NetworkBridgeFilter (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.NetworkBridgeFilter)3 ProducerInfo (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.ProducerInfo)3 RemoveSubscriptionInfo (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.RemoveSubscriptionInfo)3 SessionInfo (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.SessionInfo)3