This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit 077ec43c34531df1ed41469d9181aed8ccb0eca2 Author: Nicolas Filotto <[email protected]> AuthorDate: Tue Mar 22 11:33:19 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-geocoder --- .../apache/camel/component/geocoder/geocoder.json | 13 +++++++++ .../src/main/docs/geocoder-component.adoc | 32 ++-------------------- .../component/geocoder/GeoCoderConstants.java | 15 ++++++++++ .../camel/component/geocoder/GeoCoderEndpoint.java | 2 +- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/components/camel-geocoder/src/generated/resources/org/apache/camel/component/geocoder/geocoder.json b/components/camel-geocoder/src/generated/resources/org/apache/camel/component/geocoder/geocoder.json index e434c7e..8df7d78 100644 --- a/components/camel-geocoder/src/generated/resources/org/apache/camel/component/geocoder/geocoder.json +++ b/components/camel-geocoder/src/generated/resources/org/apache/camel/component/geocoder/geocoder.json @@ -26,6 +26,19 @@ "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] "geoApiContext": { "kind": "property", "displayName": "Geo Api Context", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.google.maps.GeoApiContext", "deprecated": false, "autowired": false, "secret": false, "description": "Configuration for Google maps API" } }, + "headers": { + "CamelGeoCoderAddress": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The formatted address" }, + "CamelGeoCoderLatlng": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The latitude and longitude of the location. Separated by comma." }, + "CamelGeoCoderLat": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The latitude of the location." }, + "CamelGeoCoderLng": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The longitude of the location." }, + "CamelGeoCoderStatus": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": true, "javaType": "org.apache.camel.component.geocoder.GeocoderStatus", "enum": [ "ERROR", "INVALID_REQUEST", "ACCESS_NOT_CONFIGURED", "OK", "OVER_QUERY_LIMIT", "OVER_DAILY_LIMIT", "REQUEST_DENIED", "UNKNOWN_ERROR", "ZERO_RESULTS" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Status code from the geocoder library. If status [...] + "CamelGeoCoderRegionCode": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The region code." }, + "CamelGeoCoderRegionName": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The region name." }, + "CamelGeoCoderCity": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The city long name." }, + "CamelGeoCoderCountryLong": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The country long name." }, + "CamelGeoCoderCountryShort": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The country short name." }, + "CamelGeoCoderPostalCode": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The postal code." } + }, "properties": { "address": { "kind": "path", "displayName": "Address", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The geo address which should be prefixed with address:" }, "latlng": { "kind": "path", "displayName": "Latlng", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The geo latitude and longitude which should be prefixed with latlng:" }, diff --git a/components/camel-geocoder/src/main/docs/geocoder-component.adoc b/components/camel-geocoder/src/main/docs/geocoder-component.adoc index 6b315d9..a8c9924 100644 --- a/components/camel-geocoder/src/main/docs/geocoder-component.adoc +++ b/components/camel-geocoder/src/main/docs/geocoder-component.adoc @@ -55,35 +55,9 @@ include::partial$component-endpoint-options.adoc[] == Exchange data format -== Message Headers - -[width="100%",cols="50%,50%",options="header",] -|======================================================================= -|Header |Description - -|`CamelGeoCoderStatus` |Mandatory. Status code from the geocoder library. If status is -`GeocoderStatus.OK` then additional headers is enriched - -|`CamelGeoCoderAddress` |The formatted address - -|`CamelGeoCoderLat` |The latitude of the location. - -|`CamelGeoCoderLng` |The longitude of the location. - -|`CamelGeoCoderLatlng` |The latitude and longitude of the location. Separated by comma. - -|`CamelGeoCoderCity` |The city long name. - -|`CamelGeoCoderRegionCode` |The region code. - -|`CamelGeoCoderRegionName` |The region name. - -|`CamelGeoCoderCountryLong` |The country long name. - -|`CamelGeoCoderCountryShort` |The country short name. - -|`CamelGeoCoderPostalCode` |The postal code. -|======================================================================= +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END Notice not all headers may be provided depending on available data and mode in use (address vs latlng). diff --git a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderConstants.java b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderConstants.java index 21fb4cb..24c93fb 100644 --- a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderConstants.java +++ b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderConstants.java @@ -16,18 +16,33 @@ */ package org.apache.camel.component.geocoder; +import org.apache.camel.spi.Metadata; + public final class GeoCoderConstants { + @Metadata(description = "The formatted address", javaType = "String") public static final String ADDRESS = "CamelGeoCoderAddress"; + @Metadata(description = "The latitude and longitude of the location. Separated by comma.", javaType = "String") public static final String LATLNG = "CamelGeoCoderLatlng"; + @Metadata(description = "The latitude of the location.", javaType = "String") public static final String LAT = "CamelGeoCoderLat"; + @Metadata(description = "The longitude of the location.", javaType = "String") public static final String LNG = "CamelGeoCoderLng"; + @Metadata(description = "Status code from the geocoder library. If status is\n" + + "`GeocoderStatus.OK` then additional headers is enriched", + javaType = "org.apache.camel.component.geocoder.GeocoderStatus", required = true) public static final String STATUS = "CamelGeoCoderStatus"; + @Metadata(description = "The region code.", javaType = "String") public static final String REGION_CODE = "CamelGeoCoderRegionCode"; + @Metadata(description = "The region name.", javaType = "String") public static final String REGION_NAME = "CamelGeoCoderRegionName"; + @Metadata(description = "The city long name.", javaType = "String") public static final String CITY = "CamelGeoCoderCity"; + @Metadata(description = "The country long name.", javaType = "String") public static final String COUNTRY_LONG = "CamelGeoCoderCountryLong"; + @Metadata(description = "The country short name.", javaType = "String") public static final String COUNTRY_SHORT = "CamelGeoCoderCountryShort"; + @Metadata(description = "The postal code.", javaType = "String") public static final String POSTAL_CODE = "CamelGeoCoderPostalCode"; private GeoCoderConstants() { diff --git a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderEndpoint.java b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderEndpoint.java index 97c7f8a..f4b07a8 100644 --- a/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderEndpoint.java +++ b/components/camel-geocoder/src/main/java/org/apache/camel/component/geocoder/GeoCoderEndpoint.java @@ -34,7 +34,7 @@ import org.apache.camel.support.DefaultEndpoint; * Find geocodes (latitude and longitude) for a given address or the other way round. */ @UriEndpoint(firstVersion = "2.12.0", scheme = "geocoder", title = "Geocoder", syntax = "geocoder:address:latlng", - producerOnly = true, category = { Category.API, Category.LOCATION }) + producerOnly = true, category = { Category.API, Category.LOCATION }, headersClass = GeoCoderConstants.class) public class GeoCoderEndpoint extends DefaultEndpoint { @UriPath
