001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.camel.component.restlet; 018 019 import org.apache.camel.Exchange; 020 import org.restlet.data.Request; 021 import org.restlet.data.Response; 022 023 /** 024 * Interface for converting between Camel message and Restlet message. 025 * 026 * @version $Revision: 778399 $ 027 */ 028 public interface RestletBinding { 029 030 /** 031 * Populate Restlet request from Camel message 032 * 033 * @param exchange message to be copied from 034 * @param response to be populated 035 */ 036 void populateRestletResponseFromExchange(Exchange exchange, Response response); 037 038 /** 039 * Populate Camel message from Restlet request 040 * 041 * @param request message to be copied from 042 * @param exchange to be populated 043 * @throws Exception is thrown if error processing 044 */ 045 void populateExchangeFromRestletRequest(Request request, Exchange exchange) throws Exception; 046 047 /** 048 * Populate Restlet Request from Camel message 049 * 050 * @param request to be populated 051 * @param exchange message to be copied from 052 */ 053 void populateRestletRequestFromExchange(Request request, Exchange exchange); 054 055 /** 056 * Populate Camel message from Restlet response 057 * 058 * @param exchange to be populated 059 * @param response message to be copied from 060 * @throws Exception is thrown if error processing 061 */ 062 void populateExchangeFromRestletResponse(Exchange exchange, Response response) throws Exception; 063 064 }