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 */
017package org.apache.camel.spi;
018
019import java.util.Map;
020
021import org.apache.camel.CamelContext;
022import org.apache.camel.Consumer;
023import org.apache.camel.Processor;
024
025/**
026 * Allows SPI to plugin a {@link RestConsumerFactory} that creates the Camel {@link Consumer} responsible
027 * for handling incoming HTTP requests from clients that request to access REST services which has been created using
028 * the <a href="http://camel.apache.org/rest-dsl">rest-dsl</a>.
029 */
030public interface RestConsumerFactory {
031
032    /**
033     * Creates a new REST <a
034     * href="http://camel.apache.org/event-driven-consumer.html">Event
035     * Driven Consumer</a>, which consumes messages from the endpoint using the given processor
036     *
037     * @param camelContext the camel context
038     * @param processor    the processor
039     * @param verb         HTTP verb such as GET, POST
040     * @param basePath     base path
041     * @param uriTemplate  uri template
042     * @param consumes     media-types for what this REST service consume as input (accept-type), is <tt>null</tt> or <tt>&#42;/&#42;</tt> for anything
043     * @param produces     media-types for what this REST service produces as output, can be <tt>null</tt>
044     * @param parameters   additional parameters
045     * @return a newly created REST consumer
046     * @throws Exception can be thrown
047     */
048    Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,
049                            String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception;
050}