Search in sources :

Example 36 with Message

use of org.apache.camel.Message in project camel by apache.

the class VolumeProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(CinderConstants.VOLUME_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "Cinder Volume ID");
    final ActionResponse out = os.blockStorage().volumes().delete(id);
    checkFailure(out, msg, "Delete volume " + id);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 37 with Message

use of org.apache.camel.Message in project camel by apache.

the class VolumeProducer method doCreate.

private void doCreate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final Volume in = messageToVolume(msg);
    final Volume out = os.blockStorage().volumes().create(in);
    msg.setBody(out);
}
Also used : Message(org.apache.camel.Message) Volume(org.openstack4j.model.storage.block.Volume)

Example 38 with Message

use of org.apache.camel.Message in project camel by apache.

the class GlanceProducer method doUpload.

private void doUpload(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String imageId = msg.getHeader(OpenstackConstants.ID, String.class);
    ObjectHelper.notEmpty(imageId, "Image ID");
    final Image in = messageHeadersToImage(msg, false);
    final Payload payload = createPayload(msg);
    final Image out = os.images().upload(imageId, payload, in);
    msg.setBody(out);
}
Also used : Message(org.apache.camel.Message) Payload(org.openstack4j.model.common.Payload) Image(org.openstack4j.model.image.Image)

Example 39 with Message

use of org.apache.camel.Message in project camel by apache.

the class SubnetProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NeutronConstants.SUBNET_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "Subnet ID");
    final ActionResponse response = os.networking().subnet().delete(id);
    checkFailure(response, msg, "Delete network " + id);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 40 with Message

use of org.apache.camel.Message in project camel by apache.

the class FlavorsProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String flavorId = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NovaConstants.FLAVOR_ID, String.class), String.class);
    ObjectHelper.notEmpty(flavorId, "FlavorID");
    final ActionResponse response = os.compute().flavors().delete(flavorId);
    checkFailure(response, msg, "Delete flavor");
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Aggregations

Message (org.apache.camel.Message)810 Exchange (org.apache.camel.Exchange)379 Test (org.junit.Test)262 Processor (org.apache.camel.Processor)120 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)109 DefaultMessage (org.apache.camel.impl.DefaultMessage)67 DefaultExchange (org.apache.camel.impl.DefaultExchange)50 Endpoint (org.apache.camel.Endpoint)46 HashMap (java.util.HashMap)41 InputStream (java.io.InputStream)39 Response (javax.ws.rs.core.Response)38 ArrayList (java.util.ArrayList)33 RouteBuilder (org.apache.camel.builder.RouteBuilder)33 Map (java.util.Map)27 Producer (org.apache.camel.Producer)27 Customer (org.apache.camel.component.cxf.jaxrs.testbean.Customer)25 ActionResponse (org.openstack4j.model.common.ActionResponse)25 IOException (java.io.IOException)24 List (java.util.List)23 CamelContext (org.apache.camel.CamelContext)23