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;
018
019import java.io.IOException;
020import java.util.Map;
021import java.util.Properties;
022
023import org.apache.camel.spi.DataFormat;
024import org.apache.camel.spi.Language;
025
026/**
027 * Catalog level interface for the {@link CamelContext}
028 */
029public interface CatalogCamelContext extends CamelContext {
030
031    /**
032     * Resolves a component's default name from its java type.
033     * <p/>
034     * A component may be used with a non default name such as <tt>activemq</tt>, <tt>wmq</tt> for the JMS component.
035     * This method can resolve the default component name by its java type.
036     *
037     * @param javaType the FQN name of the java type
038     * @return the default component name.
039     */
040    String resolveComponentDefaultName(String javaType);
041
042    /**
043     * Find information about all the Camel components available in the classpath and {@link org.apache.camel.spi.Registry}.
044     *
045     * @return a map with the component name, and value with component details.
046     * @throws LoadPropertiesException is thrown if error during classpath discovery of the components
047     * @throws IOException is thrown if error during classpath discovery of the components
048     */
049    Map<String, Properties> findComponents() throws LoadPropertiesException, IOException;
050
051    /**
052     * Find information about all the EIPs from camel-core.
053     *
054     * @return a map with node id, and value with EIP details.
055     * @throws LoadPropertiesException is thrown if error during classpath discovery of the EIPs
056     * @throws IOException is thrown if error during classpath discovery of the EIPs
057     */
058    Map<String, Properties> findEips() throws LoadPropertiesException, IOException;
059
060    /**
061     * Returns the JSON schema representation of the component and endpoint parameters for the given component name.
062     *
063     * @return the json or <tt>null</tt> if the component is <b>not</b> built with JSon schema support
064     */
065    String getComponentParameterJsonSchema(String componentName) throws IOException;
066
067    /**
068     * Returns the JSON schema representation of the {@link DataFormat} parameters for the given data format name.
069     *
070     * @return the json or <tt>null</tt> if the data format does not exist
071     */
072    String getDataFormatParameterJsonSchema(String dataFormatName) throws IOException;
073
074    /**
075     * Returns the JSON schema representation of the {@link Language} parameters for the given language name.
076     *
077     * @return the json or <tt>null</tt> if the language does not exist
078     */
079    String getLanguageParameterJsonSchema(String languageName) throws IOException;
080
081    /**
082     * Returns the JSON schema representation of the EIP parameters for the given EIP name.
083     *
084     * @return the json or <tt>null</tt> if the EIP does not exist
085     */
086    String getEipParameterJsonSchema(String eipName) throws IOException;
087
088    /**
089     * Returns a JSON schema representation of the EIP parameters for the given EIP by its id.
090     *
091     * @param nameOrId the name of the EIP ({@link NamedNode#getShortName()} or a node id to refer to a specific node from the routes.
092     * @param includeAllOptions whether to include non configured options also (eg default options)
093     * @return the json or <tt>null</tt> if the eipName or the id was not found
094     */
095    String explainEipJson(String nameOrId, boolean includeAllOptions);
096
097    /**
098     * Returns a JSON schema representation of the component parameters (not endpoint parameters) for the given component by its id.
099     *
100     * @param componentName the name of the component.
101     * @param includeAllOptions whether to include non configured options also (eg default options)
102     * @return the json or <tt>null</tt> if the component was not found
103     */
104    String explainComponentJson(String componentName, boolean includeAllOptions);
105
106    /**
107     * Returns a JSON schema representation of the component parameters (not endpoint parameters) for the given component by its id.
108     *
109     * @param dataFormat the data format instance.
110     * @param includeAllOptions whether to include non configured options also (eg default options)
111     * @return the json
112     */
113    String explainDataFormatJson(String dataFormatName, DataFormat dataFormat, boolean includeAllOptions);
114
115    /**
116     * Returns a JSON schema representation of the endpoint parameters for the given endpoint uri.
117     *
118     * @param uri the endpoint uri
119     * @param includeAllOptions whether to include non configured options also (eg default options)
120     * @return the json or <tt>null</tt> if uri parameters is invalid, or the component is <b>not</b> built with JSon schema support
121     */
122    String explainEndpointJson(String uri, boolean includeAllOptions);
123
124    /**
125     * Creates a JSON representation of all the <b>static</b> and <b>dynamic</b> configured endpoints defined in the given route(s).
126     *
127     * @param routeId for a particular route, or <tt>null</tt> for all routes
128     * @return a JSON string
129     */
130    String createRouteStaticEndpointJson(String routeId);
131
132    /**
133     * Creates a JSON representation of all the <b>static</b> (and possible <b>dynamic</b>) configured endpoints defined in the given route(s).
134     *
135     * @param routeId for a particular route, or <tt>null</tt> for all routes
136     * @param includeDynamic whether to include dynamic endpoints
137     * @return a JSON string
138     */
139    String createRouteStaticEndpointJson(String routeId, boolean includeDynamic);
140
141}