Interface CamelCatalog

  • All Known Implementing Classes:
    DefaultCamelCatalog

    public interface CamelCatalog
    Catalog of components, data formats, models (EIPs), languages, and more from this Apache Camel release.
    • Method Detail

      • getJSonSchemaResolver

        org.apache.camel.catalog.JSonSchemaResolver getJSonSchemaResolver()
        Returns the JSonSchemaResolver used by this catalog.
        Returns:
        the resolver
      • setJSonSchemaResolver

        void setJSonSchemaResolver​(org.apache.camel.catalog.JSonSchemaResolver resolver)
        To use a custom JSonSchemaResolver with this catalog.
        Parameters:
        resolver - the custom resolver
      • setRuntimeProvider

        void setRuntimeProvider​(RuntimeProvider provider)
        To plugin a custom RuntimeProvider that amends the catalog to only include information that is supported on the runtime.
      • enableCache

        void enableCache()
        Enables caching of the resources which makes the catalog faster, but keeps data in memory during caching.

        The catalog does not cache by default.

      • isCaching

        boolean isCaching()
        Whether caching has been enabled.
      • setSuggestionStrategy

        void setSuggestionStrategy​(org.apache.camel.catalog.SuggestionStrategy suggestionStrategy)
        To plugin a custom SuggestionStrategy to provide suggestion for unknown options
      • getSuggestionStrategy

        org.apache.camel.catalog.SuggestionStrategy getSuggestionStrategy()
        Gets the SuggestionStrategy in use
      • setVersionManager

        void setVersionManager​(VersionManager versionManager)
        To plugin a custom VersionManager to load other versions of Camel the catalog should use.
      • addComponent

        void addComponent​(String name,
                          String className)
        Adds a 3rd party component to this catalog.
        Parameters:
        name - the component name
        className - the fully qualified class name for the component class
      • addComponent

        void addComponent​(String name,
                          String className,
                          String jsonSchema)
        Adds a 3rd party component to this catalog.
        Parameters:
        name - the component name
        className - the fully qualified class name for the component class
        jsonSchema - the component JSON schema
      • addDataFormat

        void addDataFormat​(String name,
                           String className)
        Adds a 3rd party data format to this catalog.
        Parameters:
        name - the data format name
        className - the fully qualified class name for the data format class
      • addDataFormat

        void addDataFormat​(String name,
                           String className,
                           String jsonSchema)
        Adds a 3rd party data format to this catalog.
        Parameters:
        name - the data format name
        className - the fully qualified class name for the data format class
        jsonSchema - the data format JSON schema
      • getCatalogVersion

        String getCatalogVersion()
        The version of this Camel Catalog
      • loadVersion

        boolean loadVersion​(String version)
        Attempt to load the Camel version to be used by the catalog.

        Loading the camel-catalog JAR of the given version of choice may require internet access to download the JAR from Maven central. You can pre download the JAR and install in a local Maven repository to avoid internet access for offline environments.

        When loading a new version the cache will be invalidated.

        Important: When loading a new runtime provider version, then its strongly advised to load the same/corresponding version first using loadVersion(String).

        Parameters:
        version - the Camel version such as 2.17.1
        Returns:
        true if the version was loaded, false if not.
      • getLoadedVersion

        String getLoadedVersion()
        Gets the current loaded Camel version used by the catalog.
      • getRuntimeProviderLoadedVersion

        String getRuntimeProviderLoadedVersion()
        Gets the current loaded runtime provider version used by the catalog.
      • loadRuntimeProviderVersion

        boolean loadRuntimeProviderVersion​(String groupId,
                                           String artifactId,
                                           String version)
        Attempt to load the runtime provider version to be used by the catalog.

        Loading the runtime provider JAR of the given version of choice may require internet access to download the JAR from Maven central. You can pre download the JAR and install in a local Maven repository to avoid internet access for offline environments.

        Important: When loading a new runtime provider version, then its strongly advised to load the same/corresponding version first using loadVersion(String).

        Parameters:
        groupId - the runtime provider Maven groupId
        artifactId - the runtime provider Maven artifactId
        version - the runtime provider Maven version
        Returns:
        true if the version was loaded, false if not.
      • findComponentNames

        List<String> findComponentNames()
        Find all the component names from the Camel catalog
      • findDataFormatNames

        List<String> findDataFormatNames()
        Find all the data format names from the Camel catalog
      • findLanguageNames

        List<String> findLanguageNames()
        Find all the language names from the Camel catalog
      • findModelNames

        List<String> findModelNames()
        Find all the model names from the Camel catalog
      • findOtherNames

        List<String> findOtherNames()
        Find all the other (miscellaneous) names from the Camel catalog
      • findNames

        default List<String> findNames​(Kind kind)
        Parameters:
        kind - the kind to look for
        Returns:
        the list of part names of the given Kind available in this CamelCatalog
      • findComponentNames

        List<String> findComponentNames​(String filter)
        Find all the component names from the Camel catalog that matches the label
      • findDataFormatNames

        List<String> findDataFormatNames​(String filter)
        Find all the data format names from the Camel catalog that matches the label
      • findLanguageNames

        List<String> findLanguageNames​(String filter)
        Find all the language names from the Camel catalog that matches the label
      • findModelNames

        List<String> findModelNames​(String filter)
        Find all the model names from the Camel catalog that matches the label
      • findOtherNames

        List<String> findOtherNames​(String filter)
        Find all the other (miscellaneous) names from the Camel catalog that matches the label
      • componentJSonSchema

        String componentJSonSchema​(String name)
        Returns the component information as JSON format.
        Parameters:
        name - the component name
        Returns:
        component details in JSon
      • dataFormatJSonSchema

        String dataFormatJSonSchema​(String name)
        Returns the data format information as JSON format.
        Parameters:
        name - the data format name
        Returns:
        data format details in JSon
      • languageJSonSchema

        String languageJSonSchema​(String name)
        Returns the language information as JSON format.
        Parameters:
        name - the language name
        Returns:
        language details in JSon
      • otherJSonSchema

        String otherJSonSchema​(String name)
        Returns the other (miscellaneous) information as JSON format.
        Parameters:
        name - the other (miscellaneous) name
        Returns:
        other (miscellaneous) details in JSon
      • modelJSonSchema

        String modelJSonSchema​(String name)
        Returns the model information as JSON format.
        Parameters:
        name - the model name
        Returns:
        model details in JSon
      • findComponentLabels

        Set<String> findComponentLabels()
        Find all the unique label names all the components are using.
        Returns:
        a set of all the labels.
      • findDataFormatLabels

        Set<String> findDataFormatLabels()
        Find all the unique label names all the data formats are using.
        Returns:
        a set of all the labels.
      • findLanguageLabels

        Set<String> findLanguageLabels()
        Find all the unique label names all the languages are using.
        Returns:
        a set of all the labels.
      • findModelLabels

        Set<String> findModelLabels()
        Find all the unique label names all the models are using.
        Returns:
        a set of all the labels.
      • findOtherLabels

        Set<String> findOtherLabels()
        Find all the unique label names all the other (miscellaneous) are using.
        Returns:
        a set of all the labels.
      • archetypeCatalogAsXml

        String archetypeCatalogAsXml()
        Returns the Apache Camel Maven Archetype catalog in XML format.
        Returns:
        the catalog in XML
      • springSchemaAsXml

        String springSchemaAsXml()
        Returns the Camel Spring XML schema
        Returns:
        the spring XML schema
      • mainJsonSchema

        String mainJsonSchema()
        Returns the camel-main json schema
        Returns:
        the camel-main json schema
      • endpointProperties

        Map<String,​String> endpointProperties​(String uri)
                                             throws URISyntaxException
        Parses the endpoint uri and constructs a key/value properties of each option
        Parameters:
        uri - the endpoint uri
        Returns:
        properties as key value pairs of each endpoint option
        Throws:
        URISyntaxException
      • endpointLenientProperties

        Map<String,​String> endpointLenientProperties​(String uri)
                                                    throws URISyntaxException
        Parses the endpoint uri and constructs a key/value properties of only the lenient properties (eg custom options)

        For example using the HTTP components to provide query parameters in the endpoint uri.

        Parameters:
        uri - the endpoint uri
        Returns:
        properties as key value pairs of each lenient properties
        Throws:
        URISyntaxException
      • validateTimePattern

        boolean validateTimePattern​(String pattern)
        Validates the pattern whether its a valid time pattern.
        Parameters:
        pattern - the pattern such as 5000, 5s, 5sec, 4min, 4m30s, 1h, etc.
        Returns:
        true if valid, false if invalid
      • validateEndpointProperties

        org.apache.camel.catalog.EndpointValidationResult validateEndpointProperties​(String uri)
        Parses and validates the endpoint uri and constructs a key/value properties of each option.
        Parameters:
        uri - the endpoint uri
        Returns:
        validation result
      • validateEndpointProperties

        org.apache.camel.catalog.EndpointValidationResult validateEndpointProperties​(String uri,
                                                                                     boolean ignoreLenientProperties)
        Parses and validates the endpoint uri and constructs a key/value properties of each option.

        The option ignoreLenientProperties can be used to ignore components that uses lenient properties. When this is true, then the uri validation is stricter but would fail on properties that are not part of the component but in the uri because of using lenient properties. For example using the HTTP components to provide query parameters in the endpoint uri.

        Parameters:
        uri - the endpoint uri
        ignoreLenientProperties - whether to ignore components that uses lenient properties.
        Returns:
        validation result
      • validateEndpointProperties

        org.apache.camel.catalog.EndpointValidationResult validateEndpointProperties​(String uri,
                                                                                     boolean ignoreLenientProperties,
                                                                                     boolean consumerOnly,
                                                                                     boolean producerOnly)
        Parses and validates the endpoint uri and constructs a key/value properties of each option.

        The option ignoreLenientProperties can be used to ignore components that uses lenient properties. When this is true, then the uri validation is stricter but would fail on properties that are not part of the component but in the uri because of using lenient properties. For example using the HTTP components to provide query parameters in the endpoint uri.

        Parameters:
        uri - the endpoint uri
        ignoreLenientProperties - whether to ignore components that uses lenient properties.
        consumerOnly - whether the endpoint is only used as a consumer
        producerOnly - whether the endpoint is only used as a producer
        Returns:
        validation result
      • validateLanguagePredicate

        org.apache.camel.catalog.LanguageValidationResult validateLanguagePredicate​(ClassLoader classLoader,
                                                                                    String language,
                                                                                    String text)
        Parses and validates the language as a predicate

        Important: This requires having camel-core and the language dependencies on the classpath

        Parameters:
        classLoader - a custom classloader to use for loading the language from the classpath, or null for using default classloader
        language - the name of the language
        text - the predicate text
        Returns:
        validation result
      • validateLanguageExpression

        org.apache.camel.catalog.LanguageValidationResult validateLanguageExpression​(ClassLoader classLoader,
                                                                                     String language,
                                                                                     String text)
        Parses and validates the language as an expression

        Important: This requires having camel-core and the language dependencies on the classpath

        Parameters:
        classLoader - a custom classloader to use for loading the language from the classpath, or null for using default classloader
        language - the name of the language
        text - the expression text
        Returns:
        validation result
      • validateConfigurationProperty

        org.apache.camel.catalog.ConfigurationPropertiesValidationResult validateConfigurationProperty​(String text)
        Parses and validates the configuration property
        Parameters:
        text - the configuration text
        Returns:
        validation result
      • endpointComponentName

        String endpointComponentName​(String uri)
        Returns the component name from the given endpoint uri
        Parameters:
        uri - the endpoint uri
        Returns:
        the component name (aka scheme), or null if not possible to determine
      • asEndpointUri

        String asEndpointUri​(String scheme,
                             Map<String,​String> properties,
                             boolean encode)
                      throws URISyntaxException
        Creates an endpoint uri in Java style from the information from the properties
        Parameters:
        scheme - the endpoint schema
        properties - the properties as key value pairs
        encode - whether to URL encode the returned uri or not
        Returns:
        the constructed endpoint uri
        Throws:
        URISyntaxException - is thrown if there is encoding error
      • asEndpointUriXml

        String asEndpointUriXml​(String scheme,
                                Map<String,​String> properties,
                                boolean encode)
                         throws URISyntaxException
        Creates an endpoint uri in XML style from the information from the properties
        Parameters:
        scheme - the endpoint schema
        properties - the properties as key value pairs
        encode - whether to URL encode the returned uri or not
        Returns:
        the constructed endpoint uri
        Throws:
        URISyntaxException - is thrown if there is encoding error
      • listComponentsAsJson

        String listComponentsAsJson()
        Lists all the components summary details in JSon
      • listDataFormatsAsJson

        String listDataFormatsAsJson()
        Lists all the data formats summary details in JSon
      • listLanguagesAsJson

        String listLanguagesAsJson()
        Lists all the languages summary details in JSon
      • listModelsAsJson

        String listModelsAsJson()
        Lists all the models (EIPs) summary details in JSon
      • listOthersAsJson

        String listOthersAsJson()
        Lists all the others (miscellaneous) summary details in JSon
      • summaryAsJson

        String summaryAsJson()
        Reports a summary what the catalog contains in JSon
      • componentModel

        org.apache.camel.tooling.model.ComponentModel componentModel​(String name)
        Parameters:
        name - the component name to look up
        Returns:
        the requested component or null in case it is not available in this CamelCatalog
      • dataFormatModel

        org.apache.camel.tooling.model.DataFormatModel dataFormatModel​(String name)
        Parameters:
        name - the data format name to look up
        Returns:
        the requested data format or null in case it is not available in this CamelCatalog
      • languageModel

        org.apache.camel.tooling.model.LanguageModel languageModel​(String name)
        Parameters:
        name - the language name to look up
        Returns:
        the requested language or null in case it is not available in this CamelCatalog
      • otherModel

        org.apache.camel.tooling.model.OtherModel otherModel​(String name)
        Parameters:
        name - the other name to look up
        Returns:
        the requested other or null in case it is not available in this CamelCatalog
      • eipModel

        org.apache.camel.tooling.model.EipModel eipModel​(String name)
        Parameters:
        name - the EIP model name to look up
        Returns:
        the requested EIP model or null in case it is not available in this CamelCatalog
      • mainModel

        org.apache.camel.tooling.model.MainModel mainModel()
        Returns:
        the requested main model or null in case it is not available in this CamelCatalog
      • model

        default org.apache.camel.tooling.model.BaseModel<?> model​(Kind kind,
                                                                  String name)
        Lookup the model for the given kind and name
        Parameters:
        kind - the requested kind
        name - the name to look up
        Returns:
        the requested model or null in case it is not available in this CamelCatalog
      • modelFromMavenGAV

        org.apache.camel.tooling.model.ArtifactModel<?> modelFromMavenGAV​(String groupId,
                                                                          String artifactId,
                                                                          String version)
        Lookup the model for the given Maven GAV
        Parameters:
        groupId - maven group id
        artifactId - maven artifact id
        version - maven version (optional)
        Returns:
        the requested model or null in case it is not available in this CamelCatalog
      • loadResource

        InputStream loadResource​(String kind,
                                 String name)
        Load resource from catalog classpath
        Parameters:
        kind - The resource kind, ex. camel-jbang
        name - The resource name
        Returns:
        An input stream for reading the resource; null if the resource could not be found
      • camelReleases

        List<org.apache.camel.tooling.model.ReleaseModel> camelReleases()
        Load all Camel releases (core and spring-boot) from catalog
      • camelQuarkusReleases

        List<org.apache.camel.tooling.model.ReleaseModel> camelQuarkusReleases()
        Load all Camel Quarkus releases from catalog