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.Processor;
023
024/**
025 * Allows SPI to plugin a {@link RestApiProcessorFactory} that creates the Camel {@link Processor} responsible
026 * for servicing and generating the REST API documentation.
027 * <p/>
028 * For example the <tt>camel-swagger-java</tt> component provides such a factory that uses Swagger to generate the documentation.
029 */
030public interface RestApiProcessorFactory {
031
032    /**
033     * Creates a new REST API <a
034     * href="http://camel.apache.org/processor.html">Processor
035     * </a>, which provides API listing of the REST services
036     *
037     * @param camelContext      the camel context
038     * @param contextPath       the context-path
039     * @param contextIdPattern  id pattern to only allow Rest APIs from rest services within CamelContext's which name matches the pattern.
040     * @param parameters        additional parameters
041     * @return a newly created REST API provider
042     * @throws Exception can be thrown
043     */
044    Processor createApiProcessor(CamelContext camelContext, String contextPath, String contextIdPattern, boolean contextIdListing,
045                                 RestConfiguration configuration, Map<String, Object> parameters) throws Exception;
046
047}