1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.servicemix.client; 18 19 import javax.jbi.messaging.Fault; 20 import javax.jbi.messaging.MessageExchange; 21 import javax.jbi.messaging.MessagingException; 22 import javax.jbi.messaging.NormalizedMessage; 23 24 /** 25 * An extension of the standard {@link NormalizedMessage} which allows you to 26 * work directly with message bodies as POJOs ignoring the XML stuff or passing a binary 27 * message around as a ByteBuffer or byte[] 28 * 29 * @version $Revision: 359151 $ 30 */ 31 public interface Message extends NormalizedMessage { 32 33 /** 34 * Returns the body as a POJO. Depending on the implementation this could be 35 * a Java POJO, a DOM tree or a byte[] 36 */ 37 public Object getBody() throws MessagingException; 38 39 /** 40 * Sets the body as a POJO 41 */ 42 public void setBody(Object body) throws MessagingException; 43 44 /** 45 * Returns the message exchange 46 */ 47 public MessageExchange getExchange(); 48 49 /** 50 * Helper method to create a new fault for this message exchange 51 */ 52 public Fault createFault() throws MessagingException; 53 } 54