Search in sources :

Example 41 with Message

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

the class MessageDispatchMarshaller method tightUnmarshal.

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {
    super.tightUnmarshal(wireFormat, o, dataIn, bs);
    MessageDispatch info = (MessageDispatch) o;
    info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setDestination((ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
    info.setRedeliveryCounter(dataIn.readInt());
}
Also used : MessageDispatch(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.MessageDispatch)

Example 42 with Message

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

the class MessageMarshaller method tightMarshal1.

/**
 * Write the booleans that this object uses to a BooleanStream
 */
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
    Message info = (Message) o;
    info.beforeMarshall(wireFormat);
    int rc = super.tightMarshal1(wireFormat, o, bs);
    rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getProducerId(), bs);
    rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getDestination(), bs);
    rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getTransactionId(), bs);
    rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getOriginalDestination(), bs);
    rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getMessageId(), bs);
    rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getOriginalTransactionId(), bs);
    rc += tightMarshalString1(info.getGroupID(), bs);
    rc += tightMarshalString1(info.getCorrelationId(), bs);
    bs.writeBoolean(info.isPersistent());
    rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs);
    rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getReplyTo(), bs);
    rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs);
    rc += tightMarshalString1(info.getType(), bs);
    rc += tightMarshalBuffer1(info.getContent(), bs);
    rc += tightMarshalBuffer1(info.getMarshalledProperties(), bs);
    rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getDataStructure(), bs);
    rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getTargetConsumerId(), bs);
    bs.writeBoolean(info.isCompressed());
    rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
    rc += tightMarshalLong1(wireFormat, info.getArrival(), bs);
    rc += tightMarshalString1(info.getUserID(), bs);
    bs.writeBoolean(info.isRecievedByDFBridge());
    return rc + 9;
}
Also used : Message(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message) DataStructure(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure)

Example 43 with Message

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

the class MessageMarshaller method tightMarshal2.

/**
 * Write a object instance to data output stream
 *
 * @param o the instance to be marshaled
 * @param dataOut the output stream
 * @throws IOException thrown if an error occurs
 */
public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException {
    super.tightMarshal2(wireFormat, o, dataOut, bs);
    Message info = (Message) o;
    tightMarshalCachedObject2(wireFormat, (DataStructure) info.getProducerId(), dataOut, bs);
    tightMarshalCachedObject2(wireFormat, (DataStructure) info.getDestination(), dataOut, bs);
    tightMarshalCachedObject2(wireFormat, (DataStructure) info.getTransactionId(), dataOut, bs);
    tightMarshalCachedObject2(wireFormat, (DataStructure) info.getOriginalDestination(), dataOut, bs);
    tightMarshalNestedObject2(wireFormat, (DataStructure) info.getMessageId(), dataOut, bs);
    tightMarshalCachedObject2(wireFormat, (DataStructure) info.getOriginalTransactionId(), dataOut, bs);
    tightMarshalString2(info.getGroupID(), dataOut, bs);
    dataOut.writeInt(info.getGroupSequence());
    tightMarshalString2(info.getCorrelationId(), dataOut, bs);
    bs.readBoolean();
    tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs);
    dataOut.writeByte(info.getPriority());
    tightMarshalNestedObject2(wireFormat, (DataStructure) info.getReplyTo(), dataOut, bs);
    tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs);
    tightMarshalString2(info.getType(), dataOut, bs);
    tightMarshalBuffer2(info.getContent(), dataOut, bs);
    tightMarshalBuffer2(info.getMarshalledProperties(), dataOut, bs);
    tightMarshalNestedObject2(wireFormat, (DataStructure) info.getDataStructure(), dataOut, bs);
    tightMarshalCachedObject2(wireFormat, (DataStructure) info.getTargetConsumerId(), dataOut, bs);
    bs.readBoolean();
    dataOut.writeInt(info.getRedeliveryCounter());
    tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
    tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs);
    tightMarshalString2(info.getUserID(), dataOut, bs);
    bs.readBoolean();
    info.afterMarshall(wireFormat);
}
Also used : Message(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message)

Example 44 with Message

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

the class BaseDataStreamMarshaller method createThrowable.

private Throwable createThrowable(UTF8Buffer className, UTF8Buffer message) {
    try {
        Class clazz = Class.forName(className.toString(), false, BaseDataStreamMarshaller.class.getClassLoader());
        Constructor constructor = clazz.getConstructor(new Class[] { UTF8Buffer.class });
        return (Throwable) constructor.newInstance(new Object[] { message.toString() });
    } catch (Throwable e) {
        return new OpenwireException(message.toString(), className.toString());
    }
}
Also used : OpenwireException(io.fabric8.gateway.handlers.detecting.protocol.openwire.OpenwireException) Constructor(java.lang.reflect.Constructor)

Example 45 with Message

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

the class OpenWireFormat method looseMarshalNestedObject.

public void looseMarshalNestedObject(DataStructure o, DataByteArrayOutputStream dataOut) throws IOException {
    dataOut.writeBoolean(o != null);
    if (o != null) {
        if (o instanceof Message) {
            if (!isTightEncodingEnabled() && !isCacheEnabled()) {
                CachedEncodingTrait encoding = ((Message) o).getCachedEncoding();
                if (encoding != null && !encoding.tight() && encoding.version() == getVersion()) {
                    Buffer buffer = encoding.buffer();
                    dataOut.write(buffer.data, buffer.offset + 4, buffer.length() - 4);
                    return;
                }
            }
        }
        byte type = o.getDataStructureType();
        dataOut.writeByte(type);
        DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
        if (dsm == null) {
            throw new IOException("Unknown data type: " + type);
        }
        dsm.looseMarshal(this, o, dataOut);
    }
}
Also used : Buffer(org.fusesource.hawtbuf.Buffer) Message(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message) CachedEncodingTrait(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.CachedEncodingTrait) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)12 HashMap (java.util.HashMap)9 File (java.io.File)8 Profile (io.fabric8.api.Profile)7 Map (java.util.Map)7 Message (io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message)6 ArrayList (java.util.ArrayList)5 PatchException (io.fabric8.patch.management.PatchException)4 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)4 Container (io.fabric8.api.Container)3 Version (io.fabric8.api.Version)3 Date (java.util.Date)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 ZipFile (org.apache.commons.compress.archivers.zip.ZipFile)3 MojoFailureException (org.apache.maven.plugin.MojoFailureException)3 Git (org.eclipse.jgit.api.Git)3 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)3 RevCommit (org.eclipse.jgit.revwalk.RevCommit)3 Test (org.junit.Test)3