[
https://issues.apache.org/jira/browse/CAMEL-7487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dhiraj Bokde resolved CAMEL-7487.
---------------------------------
Resolution: Fixed
Merged PR 175
Added the following to tooling:
archetype camel-archetype-api-component
maven plugin camel-api-component-maven-plugin
The archetype generates a project that is pre-configured to generate an API
model from the Java API Interface/Class configured by user in the component
pom.xml.
The generated configuration also shows how to exclude packages, classes,
methods, substitute argument names using name and type patterns. There are a
couple of API samples that show how to use a .txt description of the API (with
parameter names), or generate and use Javadoc for API.
The maven plugin generates API model classes, and helper classes, which are
used by the archetype generated component code. The plugin also generates
Integration tests, which can be moved to src/test and edited to remove 'Ignore'
annotations add test values.
> Create an archetype and code generation plugins to generate Camel Components
> that wrap some API
> -----------------------------------------------------------------------------------------------
>
> Key: CAMEL-7487
> URL: https://issues.apache.org/jira/browse/CAMEL-7487
> Project: Camel
> Issue Type: Improvement
> Components: camel-core, tooling
> Affects Versions: 2.12.4
> Reporter: Dhiraj Bokde
> Assignee: Dhiraj Bokde
> Fix For: 2.12.4
>
>
> The Facebook component took the approach of creating an API model for the
> Facebook4J API and mapping its methods and parameters to its URI endpoint
> using API independent code. This reduced the number of lines of code in the
> component significantly while still being able to expose every operation in
> the Facebook4J API.
> This approach can be made generic, so that an API model can be created for
> any Java Class/Interface that needs to be wrapped by a Camel component. This
> model can either be manually written in a signature file similar to the
> output from the 'javap' command with a method per line with parameter names,
> or automatically generated by parsing Javadoc.
> The method and parameter names then can be mapped to the component's URI
> paths and URI parameters/options. The component could use a map of API name
> path prefixes to several APIs it supports/implements.
> An API-component archetype could generate boilerplate code that uses the
> code-generation plugins that can generate models. The component developer
> then just has to populate with code for actually creating the API proxies.
> Even integration tests can be generated (which use nulls for test values) for
> producer endpoints for the component, and the developer just needs to
> complete the skeleton test with actual values. The producer endpoint code can
> be easily copied and modified to write consumer tests.
> Components may want to customize consumer processing based on the consumer
> capabilities or features of the wrapped API/technology, which can be easily
> done by modifying the generated consumer code.
> This micro-framework for generating Camel components that use API models,
> will significantly reduce the amount of effort and time it takes to wrap any
> API and expose it as a Camel component. The framework is also useful in
> situations where an API is not readily available, but one can be written as a
> Java POJO or Interface and then wrapped as an API component.
--
This message was sent by Atlassian JIRA
(v6.2#6252)