This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new fb979e2 CAMEL-14805: Component - Use doInit for wiring instead of
doStart
fb979e2 is described below
commit fb979e2c25878064e877760306d0d6ea328a911b
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed May 27 21:01:00 2020 +0200
CAMEL-14805: Component - Use doInit for wiring instead of doStart
---
components/camel-xj/src/main/docs/xj-component.adoc | 9 ++++-----
.../src/main/java/org/apache/camel/component/xj/XJEndpoint.java | 6 +++---
.../org/apache/camel/component/xj/J2XOutputIdentityTest.java | 2 +-
.../org/apache/camel/component/xj/X2JOutputIdentityTest.java | 2 +-
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/components/camel-xj/src/main/docs/xj-component.adoc
b/components/camel-xj/src/main/docs/xj-component.adoc
index 3ca7d6d..32a07c8 100644
--- a/components/camel-xj/src/main/docs/xj-component.adoc
+++ b/components/camel-xj/src/main/docs/xj-component.adoc
@@ -31,7 +31,7 @@ for this component:
== URI format
----
-xj:[templateName]?transformDirection=XML2JSON|JSON2XML[&options]
+xj:templateName?transformDirection=XML2JSON|JSON2XML[&options]
----
[TIP]
@@ -44,8 +44,7 @@ component as well. At least look at the XSLT component
documentation how to conf
The *transformDirection* option is mandatory and must be either XML2JSON or
JSON2XML.
-In contrary to the xslt component, the *templateName* parameter is optional.
If not specified a so called
-"identity transform" will be performed.
+The *templateName* parameter allows to use _identify transforma_ by specifying
the name `identity`.
== Component options
@@ -129,7 +128,7 @@ In case of XJ it means it transforms the json document to
an equivalent xml repr
[source,java]
----
from("direct:start").
- to("xj:?transformDirection=JSON2XML");
+ to("xj:identity?transformDirection=JSON2XML");
----
Sample:
@@ -247,7 +246,7 @@ Based on the explanations above an "identity" transform
will be performed when n
[source,java]
----
from("direct:start").
- to("xj:?transformDirection=XML2JSON");
+ to("xj:identity?transformDirection=XML2JSON");
----
Given the sample input
diff --git
a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
index 197eaa5..1a21608 100644
---
a/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
+++
b/components/camel-xj/src/main/java/org/apache/camel/component/xj/XJEndpoint.java
@@ -58,14 +58,14 @@ public class XJEndpoint extends XsltSaxonEndpoint {
}
@Override
- protected void doStart() throws Exception {
- if (ObjectHelper.isEmpty(getResourceUri())) {
+ protected void doInit() throws Exception {
+ if ("identity".equalsIgnoreCase(getResourceUri())) {
// Using a stylesheet for "identity" transform is slow. but with a
{@link TransformerFactory}
// we can't get an identity transformer. But for now we leave it
that way.
setResourceUri("org/apache/camel/component/xj/identity.xsl");
}
- super.doStart();
+ super.doInit();
}
@Override
diff --git
a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputIdentityTest.java
b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputIdentityTest.java
index e61ce8e..f9d7d62 100644
---
a/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputIdentityTest.java
+++
b/components/camel-xj/src/test/java/org/apache/camel/component/xj/J2XOutputIdentityTest.java
@@ -44,7 +44,7 @@ public class J2XOutputIdentityTest extends CamelTestSupport {
@Override
public void configure() {
from("direct:start")
- .to("xj:?transformDirection=JSON2XML")
+ .to("xj:identity?transformDirection=JSON2XML")
.to("mock:result");
}
};
diff --git
a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputIdentityTest.java
b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputIdentityTest.java
index 8858b07..5a280c8 100644
---
a/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputIdentityTest.java
+++
b/components/camel-xj/src/test/java/org/apache/camel/component/xj/X2JOutputIdentityTest.java
@@ -41,7 +41,7 @@ public class X2JOutputIdentityTest extends CamelTestSupport {
@Override
public void configure() {
from("direct:start")
- .to("xj:?transformDirection=XML2JSON")
+ .to("xj:identity?transformDirection=XML2JSON")
.to("mock:result");
}
};