Search in sources :

Example 11 with Message

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

the class MessageDispatchMarshaller method looseUnmarshal.

/**
 * 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 looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
    super.looseUnmarshal(wireFormat, o, dataIn);
    MessageDispatch info = (MessageDispatch) o;
    info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setDestination((ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn));
    info.setRedeliveryCounter(dataIn.readInt());
}
Also used : MessageDispatch(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.MessageDispatch)

Example 12 with Message

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

the class MessageMarshaller method looseUnmarshal.

/**
 * 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 looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
    super.looseUnmarshal(wireFormat, o, dataIn);
    Message info = (Message) o;
    info.beforeUnmarshall(wireFormat);
    info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setDestination((ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setOriginalDestination((ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn));
    info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setGroupID(looseUnmarshalString(dataIn));
    info.setGroupSequence(dataIn.readInt());
    info.setCorrelationId(looseUnmarshalString(dataIn));
    info.setPersistent(dataIn.readBoolean());
    info.setExpiration(looseUnmarshalLong(wireFormat, dataIn));
    info.setPriority(dataIn.readByte());
    info.setReplyTo((ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
    info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
    info.setType(looseUnmarshalString(dataIn));
    info.setContent(looseUnmarshalBuffer(dataIn));
    info.setMarshalledProperties(looseUnmarshalBuffer(dataIn));
    info.setDataStructure((DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
    info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
    info.setCompressed(dataIn.readBoolean());
    info.setRedeliveryCounter(dataIn.readInt());
    if (dataIn.readBoolean()) {
        short size = dataIn.readShort();
        BrokerId[] value = new BrokerId[size];
        for (int i = 0; i < size; i++) {
            value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn);
        }
        info.setBrokerPath(value);
    } else {
        info.setBrokerPath(null);
    }
    info.setArrival(looseUnmarshalLong(wireFormat, dataIn));
    info.setUserID(looseUnmarshalString(dataIn));
    info.setRecievedByDFBridge(dataIn.readBoolean());
    info.afterUnmarshall(wireFormat);
}
Also used : Message(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message) BrokerId(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.BrokerId)

Example 13 with Message

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

the class MessageMarshaller 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);
    Message info = (Message) o;
    info.beforeUnmarshall(wireFormat);
    info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setDestination((ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setOriginalDestination((ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
    info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setGroupID(tightUnmarshalString(dataIn, bs));
    info.setGroupSequence(dataIn.readInt());
    info.setCorrelationId(tightUnmarshalString(dataIn, bs));
    info.setPersistent(bs.readBoolean());
    info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs));
    info.setPriority(dataIn.readByte());
    info.setReplyTo((ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
    info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
    info.setType(tightUnmarshalString(dataIn, bs));
    info.setContent(tightUnmarshalBuffer(dataIn, bs));
    info.setMarshalledProperties(tightUnmarshalBuffer(dataIn, bs));
    info.setDataStructure((DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
    info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
    info.setCompressed(bs.readBoolean());
    info.setRedeliveryCounter(dataIn.readInt());
    if (bs.readBoolean()) {
        short size = dataIn.readShort();
        BrokerId[] value = new BrokerId[size];
        for (int i = 0; i < size; i++) {
            value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
        }
        info.setBrokerPath(value);
    } else {
        info.setBrokerPath(null);
    }
    info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs));
    info.setUserID(tightUnmarshalString(dataIn, bs));
    info.setRecievedByDFBridge(bs.readBoolean());
    info.afterUnmarshall(wireFormat);
}
Also used : Message(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message) BrokerId(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.BrokerId)

Example 14 with Message

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

the class MessageMarshaller method looseMarshal.

/**
 * Write the booleans that this object uses to a BooleanStream
 */
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut) throws IOException {
    Message info = (Message) o;
    info.beforeMarshall(wireFormat);
    super.looseMarshal(wireFormat, o, dataOut);
    looseMarshalCachedObject(wireFormat, (DataStructure) info.getProducerId(), dataOut);
    looseMarshalCachedObject(wireFormat, (DataStructure) info.getDestination(), dataOut);
    looseMarshalCachedObject(wireFormat, (DataStructure) info.getTransactionId(), dataOut);
    looseMarshalCachedObject(wireFormat, (DataStructure) info.getOriginalDestination(), dataOut);
    looseMarshalNestedObject(wireFormat, (DataStructure) info.getMessageId(), dataOut);
    looseMarshalCachedObject(wireFormat, (DataStructure) info.getOriginalTransactionId(), dataOut);
    looseMarshalString(info.getGroupID(), dataOut);
    dataOut.writeInt(info.getGroupSequence());
    looseMarshalString(info.getCorrelationId(), dataOut);
    dataOut.writeBoolean(info.isPersistent());
    looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
    dataOut.writeByte(info.getPriority());
    looseMarshalNestedObject(wireFormat, (DataStructure) info.getReplyTo(), dataOut);
    looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
    looseMarshalString(info.getType(), dataOut);
    looseMarshalBuffer(wireFormat, info.getContent(), dataOut);
    looseMarshalBuffer(wireFormat, info.getMarshalledProperties(), dataOut);
    looseMarshalNestedObject(wireFormat, (DataStructure) info.getDataStructure(), dataOut);
    looseMarshalCachedObject(wireFormat, (DataStructure) info.getTargetConsumerId(), dataOut);
    dataOut.writeBoolean(info.isCompressed());
    dataOut.writeInt(info.getRedeliveryCounter());
    looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
    looseMarshalLong(wireFormat, info.getArrival(), dataOut);
    looseMarshalString(info.getUserID(), dataOut);
    dataOut.writeBoolean(info.isRecievedByDFBridge());
}
Also used : Message(io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message)

Example 15 with Message

use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Message in project kubernetes by ballerinax.

the class DockerHandler method pushImage.

/**
 * Push docker image.
 *
 * @param dockerModel DockerModel
 * @throws InterruptedException When error with docker build process
 * @throws IOException          When error with docker build process
 */
public void pushImage(DockerModel dockerModel) throws InterruptedException, IOException, KubernetesPluginException {
    AuthConfig authConfig = new AuthConfigBuilder().withUsername(dockerModel.getUsername()).withPassword(dockerModel.getPassword()).build();
    Config config = new ConfigBuilder().withDockerUrl(dockerModel.getDockerHost()).addToAuthConfigs(RegistryUtils.extractRegistry(dockerModel.getName()), authConfig).build();
    DockerClient client = new DefaultDockerClient(config);
    final DockerError dockerError = new DockerError();
    OutputHandle handle = client.image().withName(dockerModel.getName()).push().usingListener(new EventListener() {

        @Override
        public void onSuccess(String message) {
            pushDone.countDown();
        }

        @Override
        public void onError(String message) {
            pushDone.countDown();
            dockerError.setErrorMsg("error pushing docker image: " + message);
        }

        @Override
        public void onError(Throwable t) {
            pushDone.countDown();
            dockerError.setErrorMsg("error pushing docker image: " + t.getMessage());
        }

        @Override
        public void onEvent(String event) {
            printDebug(event);
        }
    }).toRegistry();
    pushDone.await();
    handle.close();
    client.close();
    handleError(dockerError);
}
Also used : AuthConfigBuilder(io.fabric8.docker.api.model.AuthConfigBuilder) DefaultDockerClient(io.fabric8.docker.client.DefaultDockerClient) DockerClient(io.fabric8.docker.client.DockerClient) Config(io.fabric8.docker.client.Config) AuthConfig(io.fabric8.docker.api.model.AuthConfig) DefaultDockerClient(io.fabric8.docker.client.DefaultDockerClient) AuthConfigBuilder(io.fabric8.docker.api.model.AuthConfigBuilder) ConfigBuilder(io.fabric8.docker.client.ConfigBuilder) OutputHandle(io.fabric8.docker.dsl.OutputHandle) AuthConfig(io.fabric8.docker.api.model.AuthConfig) EventListener(io.fabric8.docker.dsl.EventListener)

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