[2/3] camel git commit: CAMEL-9469: Properties component - Should include component docs
CAMEL-9469: Properties component - Should include component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/294bb237 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/294bb237 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/294bb237 Branch: refs/heads/camel-2.16.x Commit: 294bb237ab7937fea81f9be19f331e8c340092ce Parents: 0cdce29 Author: Claus IbsenAuthored: Sun Jan 3 10:41:19 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 11:51:33 2016 +0100 -- .../properties/PropertiesComponent.java | 44 ++- .../properties/PropertiesEndpoint.java | 119 +++ 2 files changed, 158 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/294bb237/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java index 952606c..b0bd45c 100644 --- a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Properties; import org.apache.camel.Endpoint; -import org.apache.camel.impl.DefaultComponent; +import org.apache.camel.impl.UriEndpointComponent; import org.apache.camel.util.FilePathResolver; import org.apache.camel.util.LRUSoftCache; import org.apache.camel.util.ObjectHelper; @@ -34,10 +34,8 @@ import org.slf4j.LoggerFactory; /** * The http://camel.apache.org/properties;>Properties Component allows you to use property placeholders when defining Endpoint URIs - * - * @version */ -public class PropertiesComponent extends DefaultComponent { +public class PropertiesComponent extends UriEndpointComponent { /** * The default prefix token. @@ -108,6 +106,7 @@ public class PropertiesComponent extends DefaultComponent { private int systemPropertiesMode = SYSTEM_PROPERTIES_MODE_OVERRIDE; public PropertiesComponent() { +super(PropertiesEndpoint.class); // include out of the box functions addFunction(new EnvPropertiesFunction()); addFunction(new SysPropertiesFunction()); @@ -143,7 +142,12 @@ public class PropertiesComponent extends DefaultComponent { String endpointUri = parseUri(remaining, paths); LOG.debug("Endpoint uri parsed as: {}", endpointUri); -return getCamelContext().getEndpoint(endpointUri); + +Endpoint delegate = getCamelContext().getEndpoint(endpointUri); +PropertiesEndpoint answer = new PropertiesEndpoint(uri, delegate, this); + +setProperties(answer, parameters); +return answer; } public String parseUri(String uri) throws Exception { @@ -214,6 +218,10 @@ public class PropertiesComponent extends DefaultComponent { return locations; } +/** + * A list of locations to load properties. You can use comma to separate multiple locations. + * This option will override any default locations and only use the locations from this option. + */ public void setLocations(String[] locations) { // make sure to trim as people may use new lines when configuring using XML // and do this in the setter as Spring/Blueprint resolves placeholders before Camel is being started @@ -227,6 +235,10 @@ public class PropertiesComponent extends DefaultComponent { this.locations = locations; } +/** + * A list of locations to load properties. You can use comma to separate multiple locations. + * This option will override any default locations and only use the locations from this option. + */ public void setLocation(String location) { setLocations(location.split(",")); } @@ -249,6 +261,9 @@ public class PropertiesComponent extends DefaultComponent { return propertiesResolver; } +/** + * To use a custom PropertiesResolver + */ public void setPropertiesResolver(PropertiesResolver propertiesResolver) { this.propertiesResolver = propertiesResolver; } @@ -257,6 +272,9 @@ public class PropertiesComponent extends DefaultComponent { return propertiesParser; } +/** + * To use a custom PropertiesParser + */ public void setPropertiesParser(PropertiesParser propertiesParser) { this.propertiesParser = propertiesParser; } @@ -265,6 +283,9 @@ public class PropertiesComponent extends DefaultComponent { return
[1/3] camel git commit: Component docs - Allow to explict specify javaType of UriPath/UriParam property to specify the preferred type to use
Repository: camel Updated Branches: refs/heads/camel-2.16.x 0cdce29ab -> 367eb6573 refs/heads/master ef9e179a5 -> 1e5bc2487 Component docs - Allow to explict specify javaType of UriPath/UriParam property to specify the preferred type to use Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1e5bc248 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1e5bc248 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1e5bc248 Branch: refs/heads/master Commit: 1e5bc2487cd83661ec2e7d6640bdd0706ad1fe21 Parents: ef9e179 Author: Claus IbsenAuthored: Sun Jan 3 11:48:38 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 11:48:38 2016 +0100 -- .../camel/component/file/GenericFileEndpoint.java | 17 + .../tools/apt/EndpointAnnotationProcessor.java | 9 + .../main/java/org/apache/camel/spi/UriParam.java | 7 +++ .../main/java/org/apache/camel/spi/UriPath.java| 7 +++ 4 files changed, 32 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1e5bc248/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java index 160fc9f..52d2af1 100644 --- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java @@ -42,6 +42,7 @@ import org.apache.camel.spi.ExceptionHandler; import org.apache.camel.spi.FactoryFinder; import org.apache.camel.spi.IdempotentRepository; import org.apache.camel.spi.Language; +import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.util.FileUtil; import org.apache.camel.util.IOHelper; @@ -73,7 +74,7 @@ public abstract class GenericFileEndpoint extends ScheduledPollEndpoint imple protected int bufferSize = FileUtil.BUFFER_SIZE; @UriParam protected String charset; -@UriParam +@UriParam(javaType = "java.lang.String") protected Expression fileName; // producer options @@ -84,7 +85,7 @@ public abstract class GenericFileEndpoint extends ScheduledPollEndpoint imple protected GenericFileExist fileExist = GenericFileExist.Override; @UriParam(label = "producer") protected String tempPrefix; -@UriParam(label = "producer") +@UriParam(label = "producer", javaType = "java.lang.String") protected Expression tempFileName; @UriParam(label = "producer,advanced", defaultValue = "true") protected boolean eagerDeleteTargetFile = true; @@ -129,17 +130,17 @@ public abstract class GenericFileEndpoint extends ScheduledPollEndpoint imple protected String include; @UriParam(label = "consumer,filter") protected String exclude; -@UriParam(label = "consumer,filter") +@UriParam(label = "consumer,filter", javaType = "java.lang.String") protected Expression move; -@UriParam(label = "consumer") +@UriParam(label = "consumer", javaType = "java.lang.String") protected Expression moveFailed; -@UriParam(label = "consumer") +@UriParam(label = "consumer", javaType = "java.lang.String") protected Expression preMove; -@UriParam(label = "producer") +@UriParam(label = "producer", javaType = "java.lang.String") protected Expression moveExisting; @UriParam(label = "consumer,filter", defaultValue = "false") protected Boolean idempotent; -@UriParam(label = "consumer,filter") +@UriParam(label = "consumer,filter", javaType = "java.lang.String") protected Expression idempotentKey; @UriParam(label = "consumer,filter") protected IdempotentRepository idempotentRepository; @@ -154,7 +155,7 @@ public abstract class GenericFileEndpoint extends ScheduledPollEndpoint imple protected String antExclude; @UriParam(label = "consumer,sort") protected Comparator sorter; -@UriParam(label = "consumer,sort") +@UriParam(label = "consumer,sort", javaType = "java.lang.String") protected Comparator sortBy; @UriParam(label = "consumer,sort") protected boolean shuffle; http://git-wip-us.apache.org/repos/asf/camel/blob/1e5bc248/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java -- diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java index
[2/2] camel git commit: Camel catalog - Validate uris with lookup value should be valid for any kind of type.
Camel catalog - Validate uris with lookup value should be valid for any kind of type. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9248691d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9248691d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9248691d Branch: refs/heads/camel-2.16.x Commit: 9248691dc094cc4fe2ec334dba4ed99e0e5cb6c3 Parents: 6c211d4 Author: Claus IbsenAuthored: Sun Jan 3 12:49:20 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:49:43 2016 +0100 -- .../java/org/apache/camel/catalog/DefaultCamelCatalog.java | 9 + .../java/org/apache/camel/catalog/CamelCatalogTest.java | 4 2 files changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/9248691d/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index c4322f0..b8dcc92 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -754,6 +754,7 @@ public class DefaultCamelCatalog implements CamelCatalog { String name = property.getKey(); String value = property.getValue(); boolean placeholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{"); +boolean lookup = value.startsWith("#") && value.length() > 1; Map row = getRow(rows, name); if (row == null) { @@ -781,7 +782,7 @@ public class DefaultCamelCatalog implements CamelCatalog { // is enum but the value is not within the enum range // but we can only check if the value is not a placeholder String enums = getPropertyEnum(rows, name); -if (!placeholder && enums != null) { +if (!placeholder && !lookup && enums != null) { String[] choices = enums.split(","); boolean found = false; for (String s : choices) { @@ -806,7 +807,7 @@ public class DefaultCamelCatalog implements CamelCatalog { } // is boolean -if (!placeholder && isPropertyBoolean(rows, name)) { +if (!placeholder && !lookup && isPropertyBoolean(rows, name)) { // value must be a boolean boolean bool = "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value); if (!bool) { @@ -815,7 +816,7 @@ public class DefaultCamelCatalog implements CamelCatalog { } // is integer -if (!placeholder && isPropertyInteger(rows, name)) { +if (!placeholder && !lookup && isPropertyInteger(rows, name)) { // value must be an integer boolean valid = validateInteger(value); if (!valid) { @@ -824,7 +825,7 @@ public class DefaultCamelCatalog implements CamelCatalog { } // is number -if (!placeholder && isPropertyNumber(rows, name)) { +if (!placeholder && !lookup && isPropertyNumber(rows, name)) { // value must be an number boolean valid = false; try { http://git-wip-us.apache.org/repos/asf/camel/blob/9248691d/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java -- diff --git a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java index 4387374..cefa765 100644 --- a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java +++ b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java @@ -464,6 +464,10 @@ public class CamelCatalogTest { // time pattern result = catalog.validateEndpointProperties("timer://foo?fixedRate=true=0=2s"); assertTrue(result.isSuccess()); + +// reference lookup +result = catalog.validateEndpointProperties("timer://foo?fixedRate=#fixed=#myDelay"); +assertTrue(result.isSuccess()); } @Test
[1/2] camel git commit: Camel catalog - Validate uris with lookup value should be valid for any kind of type.
Repository: camel Updated Branches: refs/heads/camel-2.16.x 6c211d494 -> 9248691dc refs/heads/master ff75709b4 -> e49eb8f4e Camel catalog - Validate uris with lookup value should be valid for any kind of type. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e49eb8f4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e49eb8f4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e49eb8f4 Branch: refs/heads/master Commit: e49eb8f4ee3189f8342f79a4f76e5378e897726d Parents: ff75709 Author: Claus IbsenAuthored: Sun Jan 3 12:49:20 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:49:20 2016 +0100 -- .../java/org/apache/camel/catalog/DefaultCamelCatalog.java | 9 + .../java/org/apache/camel/catalog/CamelCatalogTest.java | 4 2 files changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e49eb8f4/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index c4322f0..b8dcc92 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -754,6 +754,7 @@ public class DefaultCamelCatalog implements CamelCatalog { String name = property.getKey(); String value = property.getValue(); boolean placeholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{"); +boolean lookup = value.startsWith("#") && value.length() > 1; Map row = getRow(rows, name); if (row == null) { @@ -781,7 +782,7 @@ public class DefaultCamelCatalog implements CamelCatalog { // is enum but the value is not within the enum range // but we can only check if the value is not a placeholder String enums = getPropertyEnum(rows, name); -if (!placeholder && enums != null) { +if (!placeholder && !lookup && enums != null) { String[] choices = enums.split(","); boolean found = false; for (String s : choices) { @@ -806,7 +807,7 @@ public class DefaultCamelCatalog implements CamelCatalog { } // is boolean -if (!placeholder && isPropertyBoolean(rows, name)) { +if (!placeholder && !lookup && isPropertyBoolean(rows, name)) { // value must be a boolean boolean bool = "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value); if (!bool) { @@ -815,7 +816,7 @@ public class DefaultCamelCatalog implements CamelCatalog { } // is integer -if (!placeholder && isPropertyInteger(rows, name)) { +if (!placeholder && !lookup && isPropertyInteger(rows, name)) { // value must be an integer boolean valid = validateInteger(value); if (!valid) { @@ -824,7 +825,7 @@ public class DefaultCamelCatalog implements CamelCatalog { } // is number -if (!placeholder && isPropertyNumber(rows, name)) { +if (!placeholder && !lookup && isPropertyNumber(rows, name)) { // value must be an number boolean valid = false; try { http://git-wip-us.apache.org/repos/asf/camel/blob/e49eb8f4/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java -- diff --git a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java index 4387374..cefa765 100644 --- a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java +++ b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java @@ -464,6 +464,10 @@ public class CamelCatalogTest { // time pattern result = catalog.validateEndpointProperties("timer://foo?fixedRate=true=0=2s"); assertTrue(result.isSuccess()); + +// reference lookup +result = catalog.validateEndpointProperties("timer://foo?fixedRate=#fixed=#myDelay"); +assertTrue(result.isSuccess()); } @Test
[1/4] camel git commit: Component docs - Add missing options and fixed invalid configurations
Repository: camel Updated Branches: refs/heads/camel-2.16.x 367eb6573 -> b98c8ae65 refs/heads/master 1e5bc2487 -> ec91dc5af Component docs - Add missing options and fixed invalid configurations Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5633d3f3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5633d3f3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5633d3f3 Branch: refs/heads/master Commit: 5633d3f32f4961705916c3a49bd880727231afe2 Parents: 1e5bc24 Author: Claus IbsenAuthored: Sun Jan 3 12:01:16 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:01:16 2016 +0100 -- .../org/apache/camel/component/mock/MockComponent.java | 1 + .../org/apache/camel/component/mock/MockEndpoint.java | 13 + .../camel/component/file/FileNoOpLockFileTest.java | 2 +- .../stress/FileAsyncStressReadLockLockFileTest.java| 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/5633d3f3/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java index 3bd356e..7f42a89 100644 --- a/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java @@ -44,6 +44,7 @@ public class MockComponent extends UriEndpointComponent { if (value != null) { Processor reporter = new ThroughputLogger(new CamelLogger("org.apache.camel.component.mock:" + remaining), value); endpoint.setReporter(reporter); +endpoint.setReportGroup(value); } return endpoint; } http://git-wip-us.apache.org/repos/asf/camel/blob/5633d3f3/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java index ab4801d..8c4157e 100644 --- a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java @@ -133,6 +133,8 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { private int retainFirst; @UriParam(label = "producer", defaultValue = "-1") private int retainLast; +@UriParam(label = "producer") +private int reportGroup; @UriParam(label = "producer,advanced", defaultValue = "true") private boolean copyOnExchange = true; @@ -1219,6 +1221,17 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { this.retainLast = retainLast; } +public int isReportGroup() { +return reportGroup; +} + +/** + * A number that is used to turn on throughput logging based on groups of the size. + */ +public void setReportGroup(int reportGroup) { +this.reportGroup = reportGroup; +} + public boolean isCopyOnExchange() { return copyOnExchange; } http://git-wip-us.apache.org/repos/asf/camel/blob/5633d3f3/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java -- diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java index 248973a..afe7642 100644 --- a/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java @@ -84,7 +84,7 @@ public class FileNoOpLockFileTest extends ContextTestSupport { to("mock:report"); // for no locks - from("file://target/reports/notlocked/?noop=true=false").process(new MyNoopProcessor()). + from("file://target/reports/notlocked/?noop=true=none").process(new MyNoopProcessor()). to("mock:report"); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/5633d3f3/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockLockFileTest.java -- diff --git
[4/4] camel git commit: Camel catalog - Validate uris with time pattern is now supported
Camel catalog - Validate uris with time pattern is now supported Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b98c8ae6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b98c8ae6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b98c8ae6 Branch: refs/heads/camel-2.16.x Commit: b98c8ae650ad2425cd9fa37e67d1bd870799325a Parents: 0ddf543 Author: Claus IbsenAuthored: Sun Jan 3 12:13:53 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:15:23 2016 +0100 -- .../camel/catalog/DefaultCamelCatalog.java | 26 -- .../camel/catalog/TimePatternConverter.java | 93 .../apache/camel/catalog/CamelCatalogTest.java | 4 + 3 files changed, 117 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b98c8ae6/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index fc63bd0..c4322f0 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -817,12 +817,7 @@ public class DefaultCamelCatalog implements CamelCatalog { // is integer if (!placeholder && isPropertyInteger(rows, name)) { // value must be an integer -boolean valid = false; -try { -valid = Integer.valueOf(value) != null; -} catch (Exception e) { -// ignore -} +boolean valid = validateInteger(value); if (!valid) { result.addInvalidInteger(name, value); } @@ -862,6 +857,25 @@ public class DefaultCamelCatalog implements CamelCatalog { return result; } +private static boolean validateInteger(String value) { +boolean valid = false; +try { +valid = Integer.valueOf(value) != null; +} catch (Exception e) { +// ignore +} +if (!valid) { +// it may be a time pattern, such as 5s for 5 seconds = 5000 +try { +TimePatternConverter.toMilliSeconds(value); +valid = true; +} catch (Exception e) { +// ignore +} +} +return valid; +} + @Override public Map endpointProperties(String uri) throws URISyntaxException { // NOTICE: This logic is similar to org.apache.camel.util.EndpointHelper#endpointProperties http://git-wip-us.apache.org/repos/asf/camel/blob/b98c8ae6/platforms/catalog/src/main/java/org/apache/camel/catalog/TimePatternConverter.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/TimePatternConverter.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/TimePatternConverter.java new file mode 100644 index 000..e49ee89 --- /dev/null +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/TimePatternConverter.java @@ -0,0 +1,93 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.catalog; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * This class is a copy from camel-core so we can use it independent to validate uris with time patterns + */ +public final class TimePatternConverter { + +private static final String NUMBERS_ONLY_STRING_PATTERN = "^[-]?(\\d)+$"; +private static final String REPLACEMENT_PATTERN = "[our|inute|econd](s)?"; +private static final String HOUR_REGEX_PATTERN =
[3/4] camel git commit: Camel catalog - Validate uris with time pattern is now supported
Camel catalog - Validate uris with time pattern is now supported Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ec91dc5a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ec91dc5a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ec91dc5a Branch: refs/heads/master Commit: ec91dc5afaffbfbdebabbeabf5fb0f3d4230571f Parents: 5633d3f Author: Claus IbsenAuthored: Sun Jan 3 12:13:53 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:13:53 2016 +0100 -- .../camel/catalog/DefaultCamelCatalog.java | 26 -- .../camel/catalog/TimePatternConverter.java | 93 .../apache/camel/catalog/CamelCatalogTest.java | 4 + 3 files changed, 117 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ec91dc5a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index fc63bd0..c4322f0 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -817,12 +817,7 @@ public class DefaultCamelCatalog implements CamelCatalog { // is integer if (!placeholder && isPropertyInteger(rows, name)) { // value must be an integer -boolean valid = false; -try { -valid = Integer.valueOf(value) != null; -} catch (Exception e) { -// ignore -} +boolean valid = validateInteger(value); if (!valid) { result.addInvalidInteger(name, value); } @@ -862,6 +857,25 @@ public class DefaultCamelCatalog implements CamelCatalog { return result; } +private static boolean validateInteger(String value) { +boolean valid = false; +try { +valid = Integer.valueOf(value) != null; +} catch (Exception e) { +// ignore +} +if (!valid) { +// it may be a time pattern, such as 5s for 5 seconds = 5000 +try { +TimePatternConverter.toMilliSeconds(value); +valid = true; +} catch (Exception e) { +// ignore +} +} +return valid; +} + @Override public Map endpointProperties(String uri) throws URISyntaxException { // NOTICE: This logic is similar to org.apache.camel.util.EndpointHelper#endpointProperties http://git-wip-us.apache.org/repos/asf/camel/blob/ec91dc5a/platforms/catalog/src/main/java/org/apache/camel/catalog/TimePatternConverter.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/TimePatternConverter.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/TimePatternConverter.java new file mode 100644 index 000..e49ee89 --- /dev/null +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/TimePatternConverter.java @@ -0,0 +1,93 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.catalog; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * This class is a copy from camel-core so we can use it independent to validate uris with time patterns + */ +public final class TimePatternConverter { + +private static final String NUMBERS_ONLY_STRING_PATTERN = "^[-]?(\\d)+$"; +private static final String REPLACEMENT_PATTERN = "[our|inute|econd](s)?"; +private static final String HOUR_REGEX_PATTERN = "((\\d)*(\\d))[h|H]"; +
[2/4] camel git commit: Component docs - Add missing options and fixed invalid configurations
Component docs - Add missing options and fixed invalid configurations Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0ddf543c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0ddf543c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0ddf543c Branch: refs/heads/camel-2.16.x Commit: 0ddf543cb5940d066aa8ddee8fbf9795c9d695e2 Parents: 367eb65 Author: Claus IbsenAuthored: Sun Jan 3 12:01:16 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:07:12 2016 +0100 -- .../org/apache/camel/component/mock/MockComponent.java | 1 + .../org/apache/camel/component/mock/MockEndpoint.java | 13 + .../camel/component/file/FileNoOpLockFileTest.java | 2 +- .../stress/FileAsyncStressReadLockLockFileTest.java| 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/0ddf543c/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java index 3bd356e..7f42a89 100644 --- a/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockComponent.java @@ -44,6 +44,7 @@ public class MockComponent extends UriEndpointComponent { if (value != null) { Processor reporter = new ThroughputLogger(new CamelLogger("org.apache.camel.component.mock:" + remaining), value); endpoint.setReporter(reporter); +endpoint.setReportGroup(value); } return endpoint; } http://git-wip-us.apache.org/repos/asf/camel/blob/0ddf543c/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java index 672e902..b38a7cc 100644 --- a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java @@ -131,6 +131,8 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { private int retainFirst; @UriParam(label = "producer", defaultValue = "-1") private int retainLast; +@UriParam(label = "producer") +private int reportGroup; @UriParam(label = "producer,advanced", defaultValue = "true") private boolean copyOnExchange = true; @@ -1217,6 +1219,17 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { this.retainLast = retainLast; } +public int isReportGroup() { +return reportGroup; +} + +/** + * A number that is used to turn on throughput logging based on groups of the size. + */ +public void setReportGroup(int reportGroup) { +this.reportGroup = reportGroup; +} + public boolean isCopyOnExchange() { return copyOnExchange; } http://git-wip-us.apache.org/repos/asf/camel/blob/0ddf543c/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java -- diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java index 248973a..afe7642 100644 --- a/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java @@ -84,7 +84,7 @@ public class FileNoOpLockFileTest extends ContextTestSupport { to("mock:report"); // for no locks - from("file://target/reports/notlocked/?noop=true=false").process(new MyNoopProcessor()). + from("file://target/reports/notlocked/?noop=true=none").process(new MyNoopProcessor()). to("mock:report"); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/0ddf543c/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockLockFileTest.java -- diff --git a/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockLockFileTest.java b/camel-core/src/test/java/org/apache/camel/component/file/stress/FileAsyncStressReadLockLockFileTest.java index
camel git commit: CAMEL-9469: Properties component - Should include component docs
Repository: camel Updated Branches: refs/heads/master 8100a0286 -> 23b653879 CAMEL-9469: Properties component - Should include component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/23b65387 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/23b65387 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/23b65387 Branch: refs/heads/master Commit: 23b653879b4bf9dc095d301fde310baf8302950a Parents: 8100a02 Author: Claus IbsenAuthored: Sun Jan 3 10:41:19 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 11:14:11 2016 +0100 -- .../properties/PropertiesComponent.java | 44 ++- .../properties/PropertiesEndpoint.java | 119 +++ 2 files changed, 158 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/23b65387/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java index b076a42..77cbd6c 100644 --- a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Properties; import org.apache.camel.Endpoint; -import org.apache.camel.impl.DefaultComponent; +import org.apache.camel.impl.UriEndpointComponent; import org.apache.camel.util.FilePathResolver; import org.apache.camel.util.LRUSoftCache; import org.apache.camel.util.ObjectHelper; @@ -34,10 +34,8 @@ import org.slf4j.LoggerFactory; /** * The http://camel.apache.org/properties;>Properties Component allows you to use property placeholders when defining Endpoint URIs - * - * @version */ -public class PropertiesComponent extends DefaultComponent { +public class PropertiesComponent extends UriEndpointComponent { /** * The default prefix token. @@ -109,6 +107,7 @@ public class PropertiesComponent extends DefaultComponent { private int systemPropertiesMode = SYSTEM_PROPERTIES_MODE_OVERRIDE; public PropertiesComponent() { +super(PropertiesEndpoint.class); // include out of the box functions addFunction(new EnvPropertiesFunction()); addFunction(new SysPropertiesFunction()); @@ -149,7 +148,12 @@ public class PropertiesComponent extends DefaultComponent { String endpointUri = parseUri(remaining, paths); LOG.debug("Endpoint uri parsed as: {}", endpointUri); -return getCamelContext().getEndpoint(endpointUri); + +Endpoint delegate = getCamelContext().getEndpoint(endpointUri); +PropertiesEndpoint answer = new PropertiesEndpoint(uri, delegate, this); + +setProperties(answer, parameters); +return answer; } public String parseUri(String uri) throws Exception { @@ -220,6 +224,10 @@ public class PropertiesComponent extends DefaultComponent { return locations; } +/** + * A list of locations to load properties. You can use comma to separate multiple locations. + * This option will override any default locations and only use the locations from this option. + */ public void setLocations(String[] locations) { // make sure to trim as people may use new lines when configuring using XML // and do this in the setter as Spring/Blueprint resolves placeholders before Camel is being started @@ -233,6 +241,10 @@ public class PropertiesComponent extends DefaultComponent { this.locations = locations; } +/** + * A list of locations to load properties. You can use comma to separate multiple locations. + * This option will override any default locations and only use the locations from this option. + */ public void setLocation(String location) { setLocations(location.split(",")); } @@ -255,6 +267,9 @@ public class PropertiesComponent extends DefaultComponent { return propertiesResolver; } +/** + * To use a custom PropertiesResolver + */ public void setPropertiesResolver(PropertiesResolver propertiesResolver) { this.propertiesResolver = propertiesResolver; } @@ -263,6 +278,9 @@ public class PropertiesComponent extends DefaultComponent { return propertiesParser; } +/** + * To use a custom PropertiesParser + */ public void setPropertiesParser(PropertiesParser propertiesParser) { this.propertiesParser = propertiesParser; } @@ -271,6 +289,9 @@
camel git commit: CAMEL-9207: Fixed test and issue when grouping xml tokenizer
Repository: camel Updated Branches: refs/heads/master 23b653879 -> ef9e179a5 CAMEL-9207: Fixed test and issue when grouping xml tokenizer Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ef9e179a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ef9e179a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ef9e179a Branch: refs/heads/master Commit: ef9e179a54ee1f1181ea3262161435f39873cd75 Parents: 23b6538 Author: Claus IbsenAuthored: Sun Jan 3 11:19:58 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 11:19:58 2016 +0100 -- .../apache/camel/builder/ExpressionBuilder.java| 17 + .../camel/language/tokenizer/TokenizeLanguage.java | 8 +--- 2 files changed, 22 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ef9e179a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java -- diff --git a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java index e0ef026..f83554b 100644 --- a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java +++ b/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java @@ -1339,6 +1339,23 @@ public final class ExpressionBuilder { }; } +public static Expression groupXmlIteratorExpression(final Expression expression, final int group) { +return new ExpressionAdapter() { +public Object evaluate(Exchange exchange) { +// evaluate expression as iterator +Iterator it = expression.evaluate(exchange, Iterator.class); +ObjectHelper.notNull(it, "expression: " + expression + " evaluated on " + exchange + " must return an java.util.Iterator"); +// must use GroupTokenIterator in xml mode as we want to concat the xml parts into a single message +return new GroupTokenIterator(exchange, it, null, group); +} + +@Override +public String toString() { +return "group " + expression + " " + group + " times"; +} +}; +} + public static Expression groupIteratorExpression(final Expression expression, final String token, final int group) { return new ExpressionAdapter() { public Object evaluate(Exchange exchange) { http://git-wip-us.apache.org/repos/asf/camel/blob/ef9e179a/camel-core/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java -- diff --git a/camel-core/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java b/camel-core/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java index 24b177d..aa18750 100644 --- a/camel-core/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java +++ b/camel-core/src/main/java/org/apache/camel/language/tokenizer/TokenizeLanguage.java @@ -124,9 +124,11 @@ public class TokenizeLanguage implements Language, IsSingleton { // if group then wrap answer in group expression if (group > 0) { -// only include group token if not xml -String groupToken = isXml() ? null : token; -answer = ExpressionBuilder.groupIteratorExpression(answer, groupToken, group); +if (isXml()) { +answer = ExpressionBuilder.groupXmlIteratorExpression(answer, group); +} else { +answer = ExpressionBuilder.groupIteratorExpression(answer, token, group); +} } return answer;
[3/4] camel git commit: Component docs - Fixed invalid syntax in language component
Component docs - Fixed invalid syntax in language component Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/783e0196 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/783e0196 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/783e0196 Branch: refs/heads/camel-2.16.x Commit: 783e019619b7d6594aef0a5c26d970241b582b90 Parents: b98c8ae Author: Claus IbsenAuthored: Sun Jan 3 12:31:44 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:39:00 2016 +0100 -- .../component/language/LanguageEndpoint.java | 18 ++ 1 file changed, 18 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/783e0196/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java index 96105ac..9bacf5b 100644 --- a/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java @@ -49,6 +49,9 @@ public class LanguageEndpoint extends ResourceEndpoint { private boolean contentResolvedFromResource; @UriPath(enums = "bean,constant,el,exchangeProperty,file,groovy,header,jsonpath,jxpath,mvel,ognl,ref,simple,spel,sql,terser,tokenize,xpath,xquery,xtokenize") @Metadata(required = "true") private String languageName; +// resourceUri is optional in the language endpoint +@UriPath(description = "Path to the resource, or a reference to lookup a bean in the Registry to use as the resource") @Metadata(required = "false") +private String resourceUri; @UriParam private String script; @UriParam(defaultValue = "true") @@ -181,6 +184,21 @@ public class LanguageEndpoint extends ResourceEndpoint { } /** + * Path to the resource, or a reference to lookup a bean in the Registry to use as the resource + * + * @param resourceUri the resource path + */ +@Override +public void setResourceUri(String resourceUri) { +super.setResourceUri(resourceUri); +} + +@Override +public String getResourceUri() { +return super.getResourceUri(); +} + +/** * Sets the script to execute * * @param script the script
[2/4] camel git commit: Component docs - Add missing options
Component docs - Add missing options Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ff75709b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ff75709b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ff75709b Branch: refs/heads/master Commit: ff75709b44b172db405a78a93508fabe14a9c15e Parents: 334f5e1 Author: Claus IbsenAuthored: Sun Jan 3 12:38:38 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:38:38 2016 +0100 -- .../main/java/org/apache/camel/component/seda/SedaEndpoint.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ff75709b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java index 4d04342..29c26bb 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java @@ -54,7 +54,6 @@ import org.slf4j.LoggerFactory; @UriEndpoint(scheme = "seda", title = "SEDA", syntax = "seda:name", consumerClass = SedaConsumer.class, label = "core,endpoint") public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, MultipleConsumersSupport { private static final Logger LOG = LoggerFactory.getLogger(SedaEndpoint.class); -private volatile BlockingQueue queue; private final Set producers = new CopyOnWriteArraySet(); private final Set consumers = new CopyOnWriteArraySet(); private volatile MulticastProcessor consumerMulticastProcessor; @@ -63,6 +62,8 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, @UriPath(description = "Name of queue") @Metadata(required = "true") private String name; +@UriParam(label = "advanced", description = "Define the queue instance which will be used by the endpoint") +private BlockingQueue queue; @UriParam(defaultValue = "" + Integer.MAX_VALUE) private int size = Integer.MAX_VALUE; @@ -239,7 +240,7 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, } /** - * Define the queue instance which will be used by seda endpoint. + * Define the queue instance which will be used by the endpoint. * * This option is only for rare use-cases where you want to use a custom queue instance. */
[4/4] camel git commit: Component docs - Add missing options
Component docs - Add missing options Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6c211d49 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6c211d49 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6c211d49 Branch: refs/heads/camel-2.16.x Commit: 6c211d494b90a6c770cce91efd0f34782173f7f9 Parents: 783e019 Author: Claus IbsenAuthored: Sun Jan 3 12:38:38 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:39:06 2016 +0100 -- .../main/java/org/apache/camel/component/seda/SedaEndpoint.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/6c211d49/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java index 23f6d91..6c2a794 100644 --- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java @@ -56,7 +56,6 @@ import org.slf4j.LoggerFactory; @UriEndpoint(scheme = "seda", title = "SEDA", syntax = "seda:name", consumerClass = SedaConsumer.class, label = "core,endpoint") public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, MultipleConsumersSupport { private static final Logger LOG = LoggerFactory.getLogger(SedaEndpoint.class); -private volatile BlockingQueue queue; private final Set producers = new CopyOnWriteArraySet(); private final Set consumers = new CopyOnWriteArraySet(); private volatile MulticastProcessor consumerMulticastProcessor; @@ -65,6 +64,8 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, @UriPath(description = "Name of queue") @Metadata(required = "true") private String name; +@UriParam(label = "advanced", description = "Define the queue instance which will be used by the endpoint") +private BlockingQueue queue; @UriParam(defaultValue = "" + Integer.MAX_VALUE) private int size = Integer.MAX_VALUE; @@ -241,7 +242,7 @@ public class SedaEndpoint extends DefaultEndpoint implements BrowsableEndpoint, } /** - * Define the queue instance which will be used by seda endpoint. + * Define the queue instance which will be used by the endpoint. * * This option is only for rare use-cases where you want to use a custom queue instance. */
[1/4] camel git commit: Component docs - Fixed invalid syntax in language component
Repository: camel Updated Branches: refs/heads/camel-2.16.x b98c8ae65 -> 6c211d494 refs/heads/master ec91dc5af -> ff75709b4 Component docs - Fixed invalid syntax in language component Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/334f5e11 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/334f5e11 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/334f5e11 Branch: refs/heads/master Commit: 334f5e112e742d5c7a8f84cdc13f80d03efd1999 Parents: ec91dc5 Author: Claus IbsenAuthored: Sun Jan 3 12:31:44 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 12:31:44 2016 +0100 -- .../component/language/LanguageEndpoint.java | 18 ++ 1 file changed, 18 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/334f5e11/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java index a48b487..7afb5f1 100644 --- a/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/language/LanguageEndpoint.java @@ -55,6 +55,9 @@ public class LanguageEndpoint extends ResourceEndpoint { private boolean contentResolvedFromResource; @UriPath(enums = "bean,constant,el,exchangeProperty,file,groovy,header,jsonpath,jxpath,mvel,ognl,ref,simple,spel,sql,terser,tokenize,xpath,xquery,xtokenize") @Metadata(required = "true") private String languageName; +// resourceUri is optional in the language endpoint +@UriPath(description = "Path to the resource, or a reference to lookup a bean in the Registry to use as the resource") @Metadata(required = "false") +private String resourceUri; @UriParam private String script; @UriParam(defaultValue = "true") @@ -187,6 +190,21 @@ public class LanguageEndpoint extends ResourceEndpoint { } /** + * Path to the resource, or a reference to lookup a bean in the Registry to use as the resource + * + * @param resourceUri the resource path + */ +@Override +public void setResourceUri(String resourceUri) { +super.setResourceUri(resourceUri); +} + +@Override +public String getResourceUri() { +return super.getResourceUri(); +} + +/** * Sets the script to execute * * @param script the script
camel git commit: CAMEL-9450: Fixed test
Repository: camel Updated Branches: refs/heads/master effc3f294 -> 89e951a1a CAMEL-9450: Fixed test Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/89e951a1 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/89e951a1 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/89e951a1 Branch: refs/heads/master Commit: 89e951a1a5b96785c01832ebd471784852d1499c Parents: effc3f2 Author: Claus IbsenAuthored: Sun Jan 3 16:44:12 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 16:44:12 2016 +0100 -- .../camel/component/rest/FromRestConfigurationTest.java | 8 .../camel/component/rest/SpringFromRestConfigurationTest.xml | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/89e951a1/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java -- diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java index 4930f16..2262081 100644 --- a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java @@ -22,12 +22,10 @@ import org.apache.camel.impl.JndiRegistry; public class FromRestConfigurationTest extends FromRestGetTest { -private Object myDummy = new FooBar(); - @Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry jndi = super.createRegistry(); -jndi.bind("myDummy", myDummy); +jndi.bind("myDummy", new FooBar()); return jndi; } @@ -45,7 +43,9 @@ public class FromRestConfigurationTest extends FromRestGetTest { assertEquals("#myDummy", context.getRestConfiguration().getConsumerProperties().get("dummy")); DummyRestConsumerFactory factory = (DummyRestConsumerFactory) context.getRegistry().lookupByName("dummy-rest"); -assertSame(myDummy, factory.getDummy()); + +Object dummy = context.getRegistry().lookupByName("myDummy"); +assertSame(dummy, factory.getDummy()); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/89e951a1/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml -- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml index d6677d0..10711f1 100644 --- a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml +++ b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml @@ -25,6 +25,8 @@ + + http://camel.apache.org/schema/spring;> @@ -32,6 +34,7 @@ +
[1/2] camel git commit: Camel docs - Add missing option
Repository: camel Updated Branches: refs/heads/camel-2.16.x 671246577 -> 36d8e0231 Camel docs - Add missing option Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c7b43f25 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c7b43f25 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c7b43f25 Branch: refs/heads/camel-2.16.x Commit: c7b43f25e4cb3ea49d363c4462340b29c412ded7 Parents: 6712465 Author: Claus IbsenAuthored: Sun Jan 3 14:04:04 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 15:30:51 2016 +0100 -- .../apache/camel/component/timer/TimerComponent.java | 1 + .../apache/camel/component/timer/TimerEndpoint.java | 15 ++- 2 files changed, 15 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c7b43f25/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java index 567bc40..cb6fca5 100644 --- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java @@ -108,6 +108,7 @@ public class TimerComponent extends UriEndpointComponent { } Date date = sdf.parse(time); answer.setTime(date); +answer.setPattern(pattern); } setProperties(answer, parameters); http://git-wip-us.apache.org/repos/asf/camel/blob/c7b43f25/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java index b88583d..b6589ba 100644 --- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java @@ -53,9 +53,11 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS private boolean fixedRate; @UriParam(defaultValue = "true", label = "advanced") private boolean daemon = true; -@UriParam(label = "advanced") +@UriParam(label = "advanced", javaType = "java.lang.String") private Date time; @UriParam(label = "advanced") +private String pattern; +@UriParam(label = "advanced") private Timer timer; public TimerEndpoint() { @@ -208,6 +210,17 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS this.time = time; } +public String getPattern() { +return pattern; +} + +/** + * Allows you to specify a custom Date pattern to use for setting the time option using URI syntax. + */ +public void setPattern(String pattern) { +this.pattern = pattern; +} + public Timer getTimer(TimerConsumer consumer) { if (timer != null) { // use custom timer
[2/2] camel git commit: Camel docs - Add missing option
Camel docs - Add missing option Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/36d8e023 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/36d8e023 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/36d8e023 Branch: refs/heads/camel-2.16.x Commit: 36d8e0231f312af13bd737dfb4b480d4435c47e8 Parents: c7b43f2 Author: Claus IbsenAuthored: Sun Jan 3 14:10:06 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 15:30:58 2016 +0100 -- .../main/java/org/apache/camel/component/timer/TimerEndpoint.java | 2 +- .../java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/36d8e023/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java index b6589ba..d78a1db 100644 --- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java @@ -53,7 +53,7 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS private boolean fixedRate; @UriParam(defaultValue = "true", label = "advanced") private boolean daemon = true; -@UriParam(label = "advanced", javaType = "java.lang.String") +@UriParam(label = "advanced") private Date time; @UriParam(label = "advanced") private String pattern; http://git-wip-us.apache.org/repos/asf/camel/blob/36d8e023/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java -- diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java index 686f8d6..f892093 100644 --- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java +++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java @@ -20,6 +20,7 @@ import java.io.File; import java.net.URI; import java.net.URL; import java.util.ArrayList; +import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -131,6 +132,8 @@ public final class JsonSchemaHelper { return "string"; } else if (type.equals(File.class.getName())) { return "string"; +} else if (type.equals(Date.class.getName())) { +return "string"; } else if (type.startsWith("java.lang.Class")) { return "string"; } else if (type.startsWith("java.util.List") || type.startsWith("java.util.Collection")) {
[8/9] camel git commit: CAMEL-9470: Add missing bridgeErrorHandler option to component docs
CAMEL-9470: Add missing bridgeErrorHandler option to component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bfc39e0b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bfc39e0b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bfc39e0b Branch: refs/heads/master Commit: bfc39e0b996a308ac98e2c4e1e276d7efbe5c163 Parents: 946ed73 Author: Claus IbsenAuthored: Sun Jan 3 15:12:54 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 15:12:54 2016 +0100 -- .../org/apache/camel/impl/DefaultEndpoint.java | 25 +++- 1 file changed, 24 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/bfc39e0b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java index 24d7f6e..0bf9e74 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java @@ -59,6 +59,10 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint private EndpointConfiguration endpointConfiguration; private CamelContext camelContext; private Component component; +@UriParam(label = "consumer", optionalPrefix = "consumer.", description = "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while" ++ " the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler." ++ " By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions,that by default will be logged at WARN/ERROR level and ignored.") +private boolean bridgeErrorHandler; @UriParam(defaultValue = "InOnly", label = "advanced", description = "Sets the default exchange pattern when creating an exchange") private ExchangePattern exchangePattern = ExchangePattern.InOnly; @@ -277,6 +281,22 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint this.synchronous = synchronous; } +public boolean isBridgeErrorHandler() { +return bridgeErrorHandler; +} + +/** + * Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while + * the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and + * handled by the routing Error Handler. + * + * By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, + * that by default will be logged at WARN/ERROR level and ignored. + */ +public void setBridgeErrorHandler(boolean bridgeErrorHandler) { +this.bridgeErrorHandler = bridgeErrorHandler; +} + /** * Gets the {@link org.apache.camel.PollingConsumer} queue size, when {@link org.apache.camel.impl.EventDrivenPollingConsumer} * is being used. Notice some Camel components may have their own implementation of {@link org.apache.camel.PollingConsumer} and @@ -476,7 +496,10 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint @Override protected void doStart() throws Exception { -// noop +// the bridgeErrorHandler was orignally configured as consumer.bridgeErrorHandler so map to that style +if (bridgeErrorHandler) { +getConsumerProperties().put("bridgeErrorHandler", "true"); +} } @Override
[1/9] camel git commit: Camel docs - Add missing option
Repository: camel Updated Branches: refs/heads/camel-2.16.x 9248691dc -> 671246577 refs/heads/master e49eb8f4e -> effc3f294 Camel docs - Add missing option Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f630a872 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f630a872 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f630a872 Branch: refs/heads/master Commit: f630a8725564caa916b6c676914d357de07866bc Parents: e49eb8f Author: Claus IbsenAuthored: Sun Jan 3 14:04:04 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 14:04:04 2016 +0100 -- .../apache/camel/component/timer/TimerComponent.java | 1 + .../apache/camel/component/timer/TimerEndpoint.java | 15 ++- 2 files changed, 15 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f630a872/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java index 567bc40..cb6fca5 100644 --- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java +++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java @@ -108,6 +108,7 @@ public class TimerComponent extends UriEndpointComponent { } Date date = sdf.parse(time); answer.setTime(date); +answer.setPattern(pattern); } setProperties(answer, parameters); http://git-wip-us.apache.org/repos/asf/camel/blob/f630a872/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java index 4b0c6b4..8d63aa2 100644 --- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java @@ -53,9 +53,11 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS private boolean fixedRate; @UriParam(defaultValue = "true", label = "advanced") private boolean daemon = true; -@UriParam(label = "advanced") +@UriParam(label = "advanced", javaType = "java.lang.String") private Date time; @UriParam(label = "advanced") +private String pattern; +@UriParam(label = "advanced") private Timer timer; public TimerEndpoint() { @@ -208,6 +210,17 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS this.time = time; } +public String getPattern() { +return pattern; +} + +/** + * Allows you to specify a custom Date pattern to use for setting the time option using URI syntax. + */ +public void setPattern(String pattern) { +this.pattern = pattern; +} + public Timer getTimer(TimerConsumer consumer) { if (timer != null) { // use custom timer
[3/9] camel git commit: Camel catalog - Improved validation error summary
Camel catalog - Improved validation error summary Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4b273246 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4b273246 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4b273246 Branch: refs/heads/master Commit: 4b2732468f82362322fd3f39fe2844da42186a03 Parents: 467b3dc Author: Claus IbsenAuthored: Sun Jan 3 14:18:54 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 14:18:54 2016 +0100 -- .../camel/catalog/EndpointValidationResult.java | 30 1 file changed, 25 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4b273246/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java index 54c8b6a..5ae61b6 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java @@ -23,6 +23,8 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; +import static org.apache.camel.catalog.URISupport.isEmpty; + /** * Details result of validating endpoint uri. */ @@ -271,26 +273,44 @@ public class EndpointValidationResult implements Serializable { } if (invalidReference != null) { for (Map.Entry entry : invalidReference.entrySet()) { -if (!entry.getValue().startsWith("#")) { +boolean empty = isEmpty(entry.getValue()); +if (empty) { +options.put(entry.getKey(), "Empty reference value"); +} else if (!entry.getValue().startsWith("#")) { options.put(entry.getKey(), "Invalid reference value: " + entry.getValue() + " must start with #"); } else { -options.put(entry.getKey(), "Invalid reference value: " + entry.getValue() + " must not be empty"); +options.put(entry.getKey(), "Invalid reference value: " + entry.getValue()); } } } if (invalidBoolean != null) { for (Map.Entry entry : invalidBoolean.entrySet()) { -options.put(entry.getKey(), "Invalid boolean value: " + entry.getValue()); +boolean empty = isEmpty(entry.getValue()); +if (empty) { +options.put(entry.getKey(), "Empty boolean value"); +} else { +options.put(entry.getKey(), "Invalid boolean value: " + entry.getValue()); +} } } if (invalidInteger != null) { for (Map.Entry entry : invalidInteger.entrySet()) { -options.put(entry.getKey(), "Invalid integer value: " + entry.getValue()); +boolean empty = isEmpty(entry.getValue()); +if (empty) { +options.put(entry.getKey(), "Empty integer value"); +} else { +options.put(entry.getKey(), "Invalid integer value: " + entry.getValue()); +} } } if (invalidNumber != null) { for (Map.Entry entry : invalidNumber.entrySet()) { -options.put(entry.getKey(), "Invalid number value: " + entry.getValue()); +boolean empty = isEmpty(entry.getValue()); +if (empty) { +options.put(entry.getKey(), "Empty number value"); +} else { +options.put(entry.getKey(), "Invalid number value: " + entry.getValue()); +} } }
[4/9] camel git commit: Camel catalog - Improved validation error summary
Camel catalog - Improved validation error summary Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/67124657 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/67124657 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/67124657 Branch: refs/heads/camel-2.16.x Commit: 671246577c952e08fe0c013ffa89b4f156aed319 Parents: 9248691 Author: Claus IbsenAuthored: Sun Jan 3 14:18:54 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 14:19:43 2016 +0100 -- .../camel/catalog/EndpointValidationResult.java | 30 1 file changed, 25 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/67124657/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java index 54c8b6a..5ae61b6 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/EndpointValidationResult.java @@ -23,6 +23,8 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; +import static org.apache.camel.catalog.URISupport.isEmpty; + /** * Details result of validating endpoint uri. */ @@ -271,26 +273,44 @@ public class EndpointValidationResult implements Serializable { } if (invalidReference != null) { for (Map.Entry entry : invalidReference.entrySet()) { -if (!entry.getValue().startsWith("#")) { +boolean empty = isEmpty(entry.getValue()); +if (empty) { +options.put(entry.getKey(), "Empty reference value"); +} else if (!entry.getValue().startsWith("#")) { options.put(entry.getKey(), "Invalid reference value: " + entry.getValue() + " must start with #"); } else { -options.put(entry.getKey(), "Invalid reference value: " + entry.getValue() + " must not be empty"); +options.put(entry.getKey(), "Invalid reference value: " + entry.getValue()); } } } if (invalidBoolean != null) { for (Map.Entry entry : invalidBoolean.entrySet()) { -options.put(entry.getKey(), "Invalid boolean value: " + entry.getValue()); +boolean empty = isEmpty(entry.getValue()); +if (empty) { +options.put(entry.getKey(), "Empty boolean value"); +} else { +options.put(entry.getKey(), "Invalid boolean value: " + entry.getValue()); +} } } if (invalidInteger != null) { for (Map.Entry entry : invalidInteger.entrySet()) { -options.put(entry.getKey(), "Invalid integer value: " + entry.getValue()); +boolean empty = isEmpty(entry.getValue()); +if (empty) { +options.put(entry.getKey(), "Empty integer value"); +} else { +options.put(entry.getKey(), "Invalid integer value: " + entry.getValue()); +} } } if (invalidNumber != null) { for (Map.Entry entry : invalidNumber.entrySet()) { -options.put(entry.getKey(), "Invalid number value: " + entry.getValue()); +boolean empty = isEmpty(entry.getValue()); +if (empty) { +options.put(entry.getKey(), "Empty number value"); +} else { +options.put(entry.getKey(), "Invalid number value: " + entry.getValue()); +} } }
[5/9] camel git commit: CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer.
CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/21245070 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/21245070 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/21245070 Branch: refs/heads/master Commit: 21245070d3575af7269f794c6840319b9e1f9841 Parents: 4b27324 Author: Claus IbsenAuthored: Sun Jan 3 14:39:27 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 14:39:27 2016 +0100 -- .../camel/impl/ScheduledPollEndpoint.java | 30 ++-- .../camel/tools/apt/EipAnnotationProcessor.java | 2 +- .../tools/apt/EndpointAnnotationProcessor.java | 16 --- .../tools/apt/helper/JsonSchemaHelper.java | 9 +- .../camel/tools/apt/model/EndpointOption.java | 9 +- .../tools/apt/EndpointOptionComparatorTest.java | 8 +++--- .../java/org/apache/camel/spi/UriParam.java | 7 + 7 files changed, 55 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/21245070/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java index 28d438a..48420a4 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java @@ -44,41 +44,41 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint { private static final String QUARTZ_2_SCHEDULER = "org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerScheduler"; // if adding more options then align with org.apache.camel.impl.ScheduledPollConsumer -@UriParam(defaultValue = "true", label = "consumer,scheduler", description = "Whether the scheduler should be auto started.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "true", label = "consumer,scheduler", description = "Whether the scheduler should be auto started.") private boolean startScheduler = true; -@UriParam(defaultValue = "1000", label = "consumer,scheduler", description = "Milliseconds before the first poll starts.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "1000", label = "consumer,scheduler", description = "Milliseconds before the first poll starts.") private long initialDelay = 1000; -@UriParam(defaultValue = "500", label = "consumer,scheduler", description = "Milliseconds before the next poll.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "500", label = "consumer,scheduler", description = "Milliseconds before the next poll.") private long delay = 500; -@UriParam(defaultValue = "MILLISECONDS", label = "consumer,scheduler", description = "Time unit for initialDelay and delay options.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "MILLISECONDS", label = "consumer,scheduler", description = "Time unit for initialDelay and delay options.") private TimeUnit timeUnit = TimeUnit.MILLISECONDS; -@UriParam(defaultValue = "true", label = "consumer,scheduler", description = "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "true", label = "consumer,scheduler", description = "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.") private boolean useFixedDelay = true; -@UriParam(label = "consumer,advanced", description = "A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation" +@UriParam(optionalPrefix = "consumer.", label = "consumer,advanced", description = "A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation" + " to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.") private PollingConsumerPollStrategy pollStrategy = new DefaultPollingConsumerPollStrategy(); -@UriParam(defaultValue = "TRACE", label = "consumer,scheduler", +@UriParam(optionalPrefix = "consumer.", defaultValue = "TRACE", label = "consumer,scheduler", description = "The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.") private LoggingLevel runLoggingLevel = LoggingLevel.TRACE; -@UriParam(label = "consumer", description = "If the polling consumer did
[2/9] camel git commit: Camel docs - Add missing option
Camel docs - Add missing option Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/467b3dc6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/467b3dc6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/467b3dc6 Branch: refs/heads/master Commit: 467b3dc64a6c5907934ed231e1fe3994b860d1be Parents: f630a87 Author: Claus IbsenAuthored: Sun Jan 3 14:10:06 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 14:10:06 2016 +0100 -- .../main/java/org/apache/camel/component/timer/TimerEndpoint.java | 2 +- .../java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/467b3dc6/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java index 8d63aa2..9473bc7 100644 --- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java @@ -53,7 +53,7 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS private boolean fixedRate; @UriParam(defaultValue = "true", label = "advanced") private boolean daemon = true; -@UriParam(label = "advanced", javaType = "java.lang.String") +@UriParam(label = "advanced") private Date time; @UriParam(label = "advanced") private String pattern; http://git-wip-us.apache.org/repos/asf/camel/blob/467b3dc6/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java -- diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java index 686f8d6..f892093 100644 --- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java +++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java @@ -20,6 +20,7 @@ import java.io.File; import java.net.URI; import java.net.URL; import java.util.ArrayList; +import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -131,6 +132,8 @@ public final class JsonSchemaHelper { return "string"; } else if (type.equals(File.class.getName())) { return "string"; +} else if (type.equals(Date.class.getName())) { +return "string"; } else if (type.startsWith("java.lang.Class")) { return "string"; } else if (type.startsWith("java.util.List") || type.startsWith("java.util.Collection")) {
[6/9] camel git commit: CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer.
CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3c782dbf Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3c782dbf Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3c782dbf Branch: refs/heads/master Commit: 3c782dbf12c7c8e9a8c799e94907562630711ea3 Parents: 2124507 Author: Claus IbsenAuthored: Sun Jan 3 14:54:35 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 14:54:35 2016 +0100 -- .../camel/catalog/DefaultCamelCatalog.java | 11 + .../apache/camel/catalog/JSonSchemaHelper.java | 24 .../apache/camel/catalog/CamelCatalogTest.java | 12 ++ 3 files changed, 47 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/3c782dbf/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index b8dcc92..1c70f40 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -47,6 +47,7 @@ import static org.apache.camel.catalog.JSonSchemaHelper.getNames; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyDefaultValue; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyEnum; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyKind; +import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyOptionalPrefix; import static org.apache.camel.catalog.JSonSchemaHelper.getRow; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyBoolean; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyInteger; @@ -752,11 +753,21 @@ public class DefaultCamelCatalog implements CamelCatalog { // validate all the options for (Map.Entry property : properties.entrySet()) { String name = property.getKey(); +String optionalPrefix = getPropertyOptionalPrefix(rows, name); String value = property.getValue(); boolean placeholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{"); boolean lookup = value.startsWith("#") && value.length() > 1; Map row = getRow(rows, name); + +// maybe the name was using an optional prefix, and if so then lookup without the prefix +if (row == null && !isEmpty(optionalPrefix)) { +if (name.startsWith(optionalPrefix)) { +name = name.substring(optionalPrefix.length()); +} +row = getRow(rows, name); +} + if (row == null) { // unknown option result.addUnknown(name); http://git-wip-us.apache.org/repos/asf/camel/blob/3c782dbf/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java index a4b27df..bbfe7c1 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java @@ -233,6 +233,30 @@ public final class JSonSchemaHelper { return null; } +public static String getPropertyOptionalPrefix(List
[9/9] camel git commit: CAMEL-9470: Add missing errorHandler (consumer) option to component docs
CAMEL-9470: Add missing errorHandler (consumer) option to component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/effc3f29 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/effc3f29 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/effc3f29 Branch: refs/heads/master Commit: effc3f294f569858efdf57b35b8526a4377f4c68 Parents: bfc39e0 Author: Claus IbsenAuthored: Sun Jan 3 15:21:59 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 15:22:34 2016 +0100 -- .../org/apache/camel/impl/DefaultEndpoint.java | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/effc3f29/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java index 0bf9e74..cf6461e 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java @@ -29,6 +29,7 @@ import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; import org.apache.camel.PollingConsumer; import org.apache.camel.ResolveEndpointFailedException; +import org.apache.camel.spi.ExceptionHandler; import org.apache.camel.spi.HasId; import org.apache.camel.spi.UriParam; import org.apache.camel.support.ServiceSupport; @@ -61,8 +62,12 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint private Component component; @UriParam(label = "consumer", optionalPrefix = "consumer.", description = "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while" + " the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler." -+ " By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions,that by default will be logged at WARN/ERROR level and ignored.") ++ " By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.") private boolean bridgeErrorHandler; +@UriParam(label = "consumer,advanced", optionalPrefix = "consumer.", description = "To let the consumer use a custom ExceptionHandler." ++ " Notice if the option bridgeErrorHandler is enabled then this options is not in use." ++ " By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.") +private ExceptionHandler exceptionHandler; @UriParam(defaultValue = "InOnly", label = "advanced", description = "Sets the default exchange pattern when creating an exchange") private ExchangePattern exchangePattern = ExchangePattern.InOnly; @@ -291,12 +296,25 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint * handled by the routing Error Handler. * * By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, - * that by default will be logged at WARN/ERROR level and ignored. + * that will be logged at WARN/ERROR level and ignored. */ public void setBridgeErrorHandler(boolean bridgeErrorHandler) { this.bridgeErrorHandler = bridgeErrorHandler; } +public ExceptionHandler getExceptionHandler() { +return exceptionHandler; +} + +/** + * To let the consumer use a custom ExceptionHandler. + + Notice if the option bridgeErrorHandler is enabled then this options is not in use. + + By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored. + */ +public void setExceptionHandler(ExceptionHandler exceptionHandler) { +this.exceptionHandler = exceptionHandler; +} + /** * Gets the {@link org.apache.camel.PollingConsumer} queue size, when {@link org.apache.camel.impl.EventDrivenPollingConsumer} * is being used. Notice some Camel components may have their own implementation of {@link org.apache.camel.PollingConsumer} and @@ -496,10 +514,14 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint @Override protected void doStart() throws Exception { -// the bridgeErrorHandler was orignally configured as consumer.bridgeErrorHandler so map to that style +// the bridgeErrorHandler/exceptionHandler was originally
[7/9] camel git commit: CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer.
CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/946ed735 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/946ed735 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/946ed735 Branch: refs/heads/master Commit: 946ed7357daa98a392c5f2fb9b8f18c35e299c6e Parents: 3c782db Author: Claus IbsenAuthored: Sun Jan 3 15:00:11 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 15:00:42 2016 +0100 -- .../apache/camel/catalog/DefaultCamelCatalog.java | 15 --- .../org/apache/camel/catalog/JSonSchemaHelper.java | 17 - 2 files changed, 12 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/946ed735/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index 1c70f40..a4e638a 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -47,13 +47,13 @@ import static org.apache.camel.catalog.JSonSchemaHelper.getNames; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyDefaultValue; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyEnum; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyKind; -import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyOptionalPrefix; import static org.apache.camel.catalog.JSonSchemaHelper.getRow; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyBoolean; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyInteger; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyNumber; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyObject; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyRequired; +import static org.apache.camel.catalog.JSonSchemaHelper.stripOptionalPrefixFromName; import static org.apache.camel.catalog.URISupport.createQueryString; import static org.apache.camel.catalog.URISupport.isEmpty; import static org.apache.camel.catalog.URISupport.normalizeUri; @@ -753,21 +753,14 @@ public class DefaultCamelCatalog implements CamelCatalog { // validate all the options for (Map.Entry property : properties.entrySet()) { String name = property.getKey(); -String optionalPrefix = getPropertyOptionalPrefix(rows, name); +// the name may be using an optional prefix, so lets strip that because the options +// in the schema are listed without the prefix +name = stripOptionalPrefixFromName(rows, name); String value = property.getValue(); boolean placeholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{"); boolean lookup = value.startsWith("#") && value.length() > 1; Map row = getRow(rows, name); - -// maybe the name was using an optional prefix, and if so then lookup without the prefix -if (row == null && !isEmpty(optionalPrefix)) { -if (name.startsWith(optionalPrefix)) { -name = name.substring(optionalPrefix.length()); -} -row = getRow(rows, name); -} - if (row == null) { // unknown option result.addUnknown(name); http://git-wip-us.apache.org/repos/asf/camel/blob/946ed735/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java index bbfe7c1..2293a7a 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java @@ -233,7 +233,7 @@ public final class JSonSchemaHelper { return null; } -public static String getPropertyOptionalPrefix(List
[3/7] camel git commit: CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer.
CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/45439600 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/45439600 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/45439600 Branch: refs/heads/camel-2.16.x Commit: 45439600f960b80daa71b57665428364c00cb474 Parents: 36d8e02 Author: Claus IbsenAuthored: Sun Jan 3 14:39:27 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 17:53:49 2016 +0100 -- .../camel/impl/ScheduledPollEndpoint.java | 30 ++-- .../camel/tools/apt/EipAnnotationProcessor.java | 2 +- .../tools/apt/EndpointAnnotationProcessor.java | 16 --- .../tools/apt/helper/JsonSchemaHelper.java | 9 +- .../camel/tools/apt/model/EndpointOption.java | 9 +- .../tools/apt/EndpointOptionComparatorTest.java | 8 +++--- .../java/org/apache/camel/spi/UriParam.java | 7 + 7 files changed, 55 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/45439600/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java index 28d438a..48420a4 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java @@ -44,41 +44,41 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint { private static final String QUARTZ_2_SCHEDULER = "org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerScheduler"; // if adding more options then align with org.apache.camel.impl.ScheduledPollConsumer -@UriParam(defaultValue = "true", label = "consumer,scheduler", description = "Whether the scheduler should be auto started.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "true", label = "consumer,scheduler", description = "Whether the scheduler should be auto started.") private boolean startScheduler = true; -@UriParam(defaultValue = "1000", label = "consumer,scheduler", description = "Milliseconds before the first poll starts.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "1000", label = "consumer,scheduler", description = "Milliseconds before the first poll starts.") private long initialDelay = 1000; -@UriParam(defaultValue = "500", label = "consumer,scheduler", description = "Milliseconds before the next poll.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "500", label = "consumer,scheduler", description = "Milliseconds before the next poll.") private long delay = 500; -@UriParam(defaultValue = "MILLISECONDS", label = "consumer,scheduler", description = "Time unit for initialDelay and delay options.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "MILLISECONDS", label = "consumer,scheduler", description = "Time unit for initialDelay and delay options.") private TimeUnit timeUnit = TimeUnit.MILLISECONDS; -@UriParam(defaultValue = "true", label = "consumer,scheduler", description = "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.") +@UriParam(optionalPrefix = "consumer.", defaultValue = "true", label = "consumer,scheduler", description = "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.") private boolean useFixedDelay = true; -@UriParam(label = "consumer,advanced", description = "A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation" +@UriParam(optionalPrefix = "consumer.", label = "consumer,advanced", description = "A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation" + " to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.") private PollingConsumerPollStrategy pollStrategy = new DefaultPollingConsumerPollStrategy(); -@UriParam(defaultValue = "TRACE", label = "consumer,scheduler", +@UriParam(optionalPrefix = "consumer.", defaultValue = "TRACE", label = "consumer,scheduler", description = "The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.") private LoggingLevel runLoggingLevel = LoggingLevel.TRACE; -@UriParam(label = "consumer", description = "If the polling
[1/7] camel git commit: Fixed test
Repository: camel Updated Branches: refs/heads/camel-2.16.x 36d8e0231 -> 070305832 refs/heads/master 89e951a1a -> 23df4a35d Fixed test Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a9316ebe Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a9316ebe Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a9316ebe Branch: refs/heads/master Commit: a9316ebecd6225e48957439abf583d4043383ff9 Parents: 89e951a Author: Claus IbsenAuthored: Sun Jan 3 17:52:46 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 17:52:46 2016 +0100 -- .../org/apache/camel/component/boon/BoonDataFormatTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a9316ebe/components/camel-boon/src/test/java/org/apache/camel/component/boon/BoonDataFormatTest.java -- diff --git a/components/camel-boon/src/test/java/org/apache/camel/component/boon/BoonDataFormatTest.java b/components/camel-boon/src/test/java/org/apache/camel/component/boon/BoonDataFormatTest.java index 37269ba..cf58df0 100644 --- a/components/camel-boon/src/test/java/org/apache/camel/component/boon/BoonDataFormatTest.java +++ b/components/camel-boon/src/test/java/org/apache/camel/component/boon/BoonDataFormatTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.boon; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -30,7 +31,7 @@ public class BoonDataFormatTest extends CamelTestSupport { @Test public void testMarshalAndUnmarshalMap() throws Exception { -Map in = new HashMap (); +Map in = new LinkedHashMap (); in.put("name", "Camel"); MockEndpoint mock = getMockEndpoint("mock:reverse"); @@ -92,7 +93,7 @@ public class BoonDataFormatTest extends CamelTestSupport { TestPojo in = new TestPojo(); in.setName("Camel"); -HashMap map = new HashMap (); +HashMap map = new LinkedHashMap (); map.put("test1", in); map.put("test2", in);
[4/7] camel git commit: CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer.
CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0d48cab8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0d48cab8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0d48cab8 Branch: refs/heads/camel-2.16.x Commit: 0d48cab84216448c95f476ba5585716129038ed4 Parents: 4543960 Author: Claus IbsenAuthored: Sun Jan 3 14:54:35 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 17:53:56 2016 +0100 -- .../camel/catalog/DefaultCamelCatalog.java | 11 + .../apache/camel/catalog/JSonSchemaHelper.java | 24 .../apache/camel/catalog/CamelCatalogTest.java | 12 ++ 3 files changed, 47 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/0d48cab8/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index b8dcc92..1c70f40 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -47,6 +47,7 @@ import static org.apache.camel.catalog.JSonSchemaHelper.getNames; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyDefaultValue; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyEnum; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyKind; +import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyOptionalPrefix; import static org.apache.camel.catalog.JSonSchemaHelper.getRow; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyBoolean; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyInteger; @@ -752,11 +753,21 @@ public class DefaultCamelCatalog implements CamelCatalog { // validate all the options for (Map.Entry property : properties.entrySet()) { String name = property.getKey(); +String optionalPrefix = getPropertyOptionalPrefix(rows, name); String value = property.getValue(); boolean placeholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{"); boolean lookup = value.startsWith("#") && value.length() > 1; Map row = getRow(rows, name); + +// maybe the name was using an optional prefix, and if so then lookup without the prefix +if (row == null && !isEmpty(optionalPrefix)) { +if (name.startsWith(optionalPrefix)) { +name = name.substring(optionalPrefix.length()); +} +row = getRow(rows, name); +} + if (row == null) { // unknown option result.addUnknown(name); http://git-wip-us.apache.org/repos/asf/camel/blob/0d48cab8/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java index a4b27df..bbfe7c1 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java @@ -233,6 +233,30 @@ public final class JSonSchemaHelper { return null; } +public static String getPropertyOptionalPrefix(List > rows, String name) { +for (Map row : rows) { +String optionalPrefix = null; +boolean found = false; +if (row.containsKey("optionalPrefix")) { +optionalPrefix = row.get("optionalPrefix"); +} +if (row.containsKey("name")) { +String key = name; +if (optionalPrefix != null && key.startsWith(optionalPrefix)) { +key = key.substring(optionalPrefix.length()); +// found the optional prefix so remove it from the key, and lookup again +return getPropertyOptionalPrefix(rows, key); +} else { +found = key.equals(row.get("name")); +} +} +if (found) { +return optionalPrefix; +} +} +return null; +} +
[2/7] camel git commit: Polished
Polished Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/23df4a35 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/23df4a35 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/23df4a35 Branch: refs/heads/master Commit: 23df4a35df2552287256f26c0ec5106be198ae2a Parents: a9316eb Author: Claus IbsenAuthored: Sun Jan 3 17:53:01 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 17:53:01 2016 +0100 -- .../java/org/apache/camel/component/boon/BoonDataFormat.java| 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/23df4a35/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java -- diff --git a/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java b/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java index 65c9087..fc6fa0b 100644 --- a/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java +++ b/components/camel-boon/src/main/java/org/apache/camel/component/boon/BoonDataFormat.java @@ -26,9 +26,10 @@ import java.util.HashMap; import java.util.List; import org.apache.camel.Exchange; +import org.apache.camel.NonManagedService; import org.apache.camel.spi.DataFormat; import org.apache.camel.spi.DataFormatName; -import org.apache.camel.support.ChildServiceSupport; +import org.apache.camel.support.ServiceSupport; import org.apache.camel.util.IOHelper; import org.boon.json.JsonFactory; import org.boon.json.ObjectMapper; @@ -39,7 +40,7 @@ import org.boon.json.ObjectMapper; * href="http://richardhightower.github.io/site/Boon/;>Boon to marshal to * and from JSON. */ -public class BoonDataFormat extends ChildServiceSupport implements DataFormat, DataFormatName { +public class BoonDataFormat extends ServiceSupport implements DataFormat, DataFormatName, NonManagedService { private final ObjectMapper objectMapper; private Class unmarshalType;
[6/7] camel git commit: CAMEL-9470: Add missing bridgeErrorHandler option to component docs
CAMEL-9470: Add missing bridgeErrorHandler option to component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ae75d8d1 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ae75d8d1 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ae75d8d1 Branch: refs/heads/camel-2.16.x Commit: ae75d8d1533e9e32315904c107588f2d9798cf18 Parents: 2f01cf1 Author: Claus IbsenAuthored: Sun Jan 3 15:12:54 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 17:54:14 2016 +0100 -- .../org/apache/camel/impl/DefaultEndpoint.java | 25 +++- 1 file changed, 24 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ae75d8d1/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java index 24d7f6e..0bf9e74 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java @@ -59,6 +59,10 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint private EndpointConfiguration endpointConfiguration; private CamelContext camelContext; private Component component; +@UriParam(label = "consumer", optionalPrefix = "consumer.", description = "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while" ++ " the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler." ++ " By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions,that by default will be logged at WARN/ERROR level and ignored.") +private boolean bridgeErrorHandler; @UriParam(defaultValue = "InOnly", label = "advanced", description = "Sets the default exchange pattern when creating an exchange") private ExchangePattern exchangePattern = ExchangePattern.InOnly; @@ -277,6 +281,22 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint this.synchronous = synchronous; } +public boolean isBridgeErrorHandler() { +return bridgeErrorHandler; +} + +/** + * Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while + * the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and + * handled by the routing Error Handler. + * + * By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, + * that by default will be logged at WARN/ERROR level and ignored. + */ +public void setBridgeErrorHandler(boolean bridgeErrorHandler) { +this.bridgeErrorHandler = bridgeErrorHandler; +} + /** * Gets the {@link org.apache.camel.PollingConsumer} queue size, when {@link org.apache.camel.impl.EventDrivenPollingConsumer} * is being used. Notice some Camel components may have their own implementation of {@link org.apache.camel.PollingConsumer} and @@ -476,7 +496,10 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint @Override protected void doStart() throws Exception { -// noop +// the bridgeErrorHandler was orignally configured as consumer.bridgeErrorHandler so map to that style +if (bridgeErrorHandler) { +getConsumerProperties().put("bridgeErrorHandler", "true"); +} } @Override
[7/7] camel git commit: CAMEL-9470: Add missing errorHandler (consumer) option to component docs
CAMEL-9470: Add missing errorHandler (consumer) option to component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/07030583 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/07030583 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/07030583 Branch: refs/heads/camel-2.16.x Commit: 070305832c0f504fdd29a4eae58d7566d37e777e Parents: ae75d8d Author: Claus IbsenAuthored: Sun Jan 3 15:21:59 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 17:54:24 2016 +0100 -- .../org/apache/camel/impl/DefaultEndpoint.java | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/07030583/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java index 0bf9e74..cf6461e 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java @@ -29,6 +29,7 @@ import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; import org.apache.camel.PollingConsumer; import org.apache.camel.ResolveEndpointFailedException; +import org.apache.camel.spi.ExceptionHandler; import org.apache.camel.spi.HasId; import org.apache.camel.spi.UriParam; import org.apache.camel.support.ServiceSupport; @@ -61,8 +62,12 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint private Component component; @UriParam(label = "consumer", optionalPrefix = "consumer.", description = "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while" + " the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler." -+ " By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions,that by default will be logged at WARN/ERROR level and ignored.") ++ " By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.") private boolean bridgeErrorHandler; +@UriParam(label = "consumer,advanced", optionalPrefix = "consumer.", description = "To let the consumer use a custom ExceptionHandler." ++ " Notice if the option bridgeErrorHandler is enabled then this options is not in use." ++ " By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.") +private ExceptionHandler exceptionHandler; @UriParam(defaultValue = "InOnly", label = "advanced", description = "Sets the default exchange pattern when creating an exchange") private ExchangePattern exchangePattern = ExchangePattern.InOnly; @@ -291,12 +296,25 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint * handled by the routing Error Handler. * * By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, - * that by default will be logged at WARN/ERROR level and ignored. + * that will be logged at WARN/ERROR level and ignored. */ public void setBridgeErrorHandler(boolean bridgeErrorHandler) { this.bridgeErrorHandler = bridgeErrorHandler; } +public ExceptionHandler getExceptionHandler() { +return exceptionHandler; +} + +/** + * To let the consumer use a custom ExceptionHandler. + + Notice if the option bridgeErrorHandler is enabled then this options is not in use. + + By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored. + */ +public void setExceptionHandler(ExceptionHandler exceptionHandler) { +this.exceptionHandler = exceptionHandler; +} + /** * Gets the {@link org.apache.camel.PollingConsumer} queue size, when {@link org.apache.camel.impl.EventDrivenPollingConsumer} * is being used. Notice some Camel components may have their own implementation of {@link org.apache.camel.PollingConsumer} and @@ -496,10 +514,14 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint @Override protected void doStart() throws Exception { -// the bridgeErrorHandler was orignally configured as consumer.bridgeErrorHandler so map to that style +// the bridgeErrorHandler/exceptionHandler was
[5/7] camel git commit: CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer.
CAMEL-9470: Component docs - Some options support using an optional prefix such as consumer. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2f01cf1c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2f01cf1c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2f01cf1c Branch: refs/heads/camel-2.16.x Commit: 2f01cf1c56228fb972bda8c3e52931e8f69d2ed6 Parents: 0d48cab Author: Claus IbsenAuthored: Sun Jan 3 15:00:11 2016 +0100 Committer: Claus Ibsen Committed: Sun Jan 3 17:54:07 2016 +0100 -- .../apache/camel/catalog/DefaultCamelCatalog.java | 15 --- .../org/apache/camel/catalog/JSonSchemaHelper.java | 17 - 2 files changed, 12 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/2f01cf1c/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java index 1c70f40..a4e638a 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java @@ -47,13 +47,13 @@ import static org.apache.camel.catalog.JSonSchemaHelper.getNames; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyDefaultValue; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyEnum; import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyKind; -import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyOptionalPrefix; import static org.apache.camel.catalog.JSonSchemaHelper.getRow; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyBoolean; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyInteger; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyNumber; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyObject; import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyRequired; +import static org.apache.camel.catalog.JSonSchemaHelper.stripOptionalPrefixFromName; import static org.apache.camel.catalog.URISupport.createQueryString; import static org.apache.camel.catalog.URISupport.isEmpty; import static org.apache.camel.catalog.URISupport.normalizeUri; @@ -753,21 +753,14 @@ public class DefaultCamelCatalog implements CamelCatalog { // validate all the options for (Map.Entry property : properties.entrySet()) { String name = property.getKey(); -String optionalPrefix = getPropertyOptionalPrefix(rows, name); +// the name may be using an optional prefix, so lets strip that because the options +// in the schema are listed without the prefix +name = stripOptionalPrefixFromName(rows, name); String value = property.getValue(); boolean placeholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{"); boolean lookup = value.startsWith("#") && value.length() > 1; Map row = getRow(rows, name); - -// maybe the name was using an optional prefix, and if so then lookup without the prefix -if (row == null && !isEmpty(optionalPrefix)) { -if (name.startsWith(optionalPrefix)) { -name = name.substring(optionalPrefix.length()); -} -row = getRow(rows, name); -} - if (row == null) { // unknown option result.addUnknown(name); http://git-wip-us.apache.org/repos/asf/camel/blob/2f01cf1c/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java -- diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java index bbfe7c1..2293a7a 100644 --- a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java +++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java @@ -233,7 +233,7 @@ public final class JSonSchemaHelper { return null; } -public static String getPropertyOptionalPrefix(List > rows, String name) { +public static String stripOptionalPrefixFromName(List > rows, String name) { for (Map row : rows) { String optionalPrefix = null;