Search in sources :

Example 41 with Message

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

the class KeypairProducer method doCreate.

private void doCreate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String name = msg.getHeader(OpenstackConstants.NAME, String.class);
    ObjectHelper.notEmpty(name, "Keypair name");
    final String body = msg.getBody(String.class);
    final Keypair kp = os.compute().keypairs().create(name, body);
    msg.setBody(kp);
}
Also used : Keypair(org.openstack4j.model.compute.Keypair) Message(org.apache.camel.Message)

Example 42 with Message

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

the class KeypairProducer method doGet.

private void doGet(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String keypairName = msg.getHeader(OpenstackConstants.NAME, String.class);
    ObjectHelper.notEmpty(keypairName, "Keypair name");
    final Keypair kp = os.compute().keypairs().get(keypairName);
    msg.setBody(kp);
}
Also used : Keypair(org.openstack4j.model.compute.Keypair) Message(org.apache.camel.Message)

Example 43 with Message

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

the class KeypairProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String keypairName = msg.getHeader(OpenstackConstants.NAME, String.class);
    ObjectHelper.notEmpty(keypairName, "Keypair name");
    final ActionResponse response = os.compute().keypairs().delete(keypairName);
    checkFailure(response, msg, "Delete keypair " + keypairName);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 44 with Message

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

the class ServerProducer method doGet.

private void doGet(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String serverId = msg.getHeader(OpenstackConstants.ID, String.class);
    ObjectHelper.notEmpty(serverId, "Server ID");
    final Server result = os.compute().servers().get(serverId);
    msg.setBody(result);
}
Also used : Message(org.apache.camel.Message) Server(org.openstack4j.model.compute.Server)

Example 45 with Message

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

the class ProjectProducer method doUpdate.

private void doUpdate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final Project in = messageToProject(msg);
    final Project out = osV3Client.identity().projects().update(in);
    msg.setBody(out);
}
Also used : Project(org.openstack4j.model.identity.v3.Project) Message(org.apache.camel.Message)

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