You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/02/09 10:56:04 UTC
[1/2] camel git commit: CAMEL-7999: apt plugin should support
@Metadata required for endpoint/component parameters
Repository: camel
Updated Branches:
refs/heads/master ba7b652fc -> 06f6e1d64
CAMEL-7999: apt plugin should support @Metadata required for endpoint/component parameters
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2a5dda60
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2a5dda60
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2a5dda60
Branch: refs/heads/master
Commit: 2a5dda60bc0940bace3118d248a170c47ed573b7
Parents: ba7b652
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Feb 9 10:24:04 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Feb 9 10:24:04 2015 +0100
----------------------------------------------------------------------
.../camel/component/rest/RestEndpoint.java | 42 +++++++++++++++-
.../tools/apt/EndpointAnnotationProcessor.java | 53 ++++++++++++++++----
2 files changed, 83 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2a5dda60/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
index 18811dc..e6c1f9b 100644
--- a/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
@@ -25,6 +25,7 @@ import org.apache.camel.NoSuchBeanException;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.RestConfiguration;
import org.apache.camel.spi.RestConsumerFactory;
import org.apache.camel.spi.UriEndpoint;
@@ -36,9 +37,9 @@ import org.apache.camel.util.ObjectHelper;
@UriEndpoint(scheme = "rest", label = "core,http,rest")
public class RestEndpoint extends DefaultEndpoint {
- @UriPath
+ @UriPath(enums = "get,post,put,delete,patch,head,trace,connect,options") @Metadata(required = "true")
private String method;
- @UriPath
+ @UriPath @Metadata(required = "true")
private String path;
@UriPath
private String uriTemplate;
@@ -72,6 +73,9 @@ public class RestEndpoint extends DefaultEndpoint {
return method;
}
+ /**
+ * HTTP method to use.
+ */
public void setMethod(String method) {
this.method = method;
}
@@ -80,6 +84,9 @@ public class RestEndpoint extends DefaultEndpoint {
return path;
}
+ /**
+ * The base path
+ */
public void setPath(String path) {
this.path = path;
}
@@ -88,6 +95,9 @@ public class RestEndpoint extends DefaultEndpoint {
return uriTemplate;
}
+ /**
+ * The uri template
+ */
public void setUriTemplate(String uriTemplate) {
this.uriTemplate = uriTemplate;
}
@@ -96,6 +106,10 @@ public class RestEndpoint extends DefaultEndpoint {
return consumes;
}
+ /**
+ * Media type such as: 'text/xml', or 'application/json' this REST service accepts.
+ * By default we accept all kinds of types.
+ */
public void setConsumes(String consumes) {
this.consumes = consumes;
}
@@ -104,6 +118,9 @@ public class RestEndpoint extends DefaultEndpoint {
return produces;
}
+ /**
+ * Media type such as: 'text/xml', or 'application/json' this REST service returns.
+ */
public void setProduces(String produces) {
this.produces = produces;
}
@@ -112,6 +129,12 @@ public class RestEndpoint extends DefaultEndpoint {
return componentName;
}
+ /**
+ * The Camel Rest component to use for the REST transport, such as restlet, spark-rest.
+ * If no component has been explicit configured, then Camel will lookup if there is a Camel component
+ * that integrates with the Rest DSL, or if a org.apache.camel.spi.RestConsumerFactory is registered in the registry.
+ * If either one is found, then that is being used.
+ */
public void setComponentName(String componentName) {
this.componentName = componentName;
}
@@ -120,6 +143,9 @@ public class RestEndpoint extends DefaultEndpoint {
return inType;
}
+ /**
+ * To declare the incoming POJO binding type as a FQN class name
+ */
public void setInType(String inType) {
this.inType = inType;
}
@@ -128,6 +154,9 @@ public class RestEndpoint extends DefaultEndpoint {
return outType;
}
+ /**
+ * To declare the outgoing POJO binding type as a FQN class name
+ */
public void setOutType(String outType) {
this.outType = outType;
}
@@ -136,6 +165,9 @@ public class RestEndpoint extends DefaultEndpoint {
return routeId;
}
+ /**
+ * Name of the route this REST services creates
+ */
public void setRouteId(String routeId) {
this.routeId = routeId;
}
@@ -144,6 +176,9 @@ public class RestEndpoint extends DefaultEndpoint {
return description;
}
+ /**
+ * Human description to document this REST service
+ */
public void setDescription(String description) {
this.description = description;
}
@@ -152,6 +187,9 @@ public class RestEndpoint extends DefaultEndpoint {
return parameters;
}
+ /**
+ * Additional parameters to configure the consumer of the REST transport for this REST service
+ */
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2a5dda60/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 d580929..22d7f34 100644
--- 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
@@ -46,6 +46,7 @@ import static org.apache.camel.tools.apt.JsonSchemaHelper.sanitizeDescription;
import static org.apache.camel.tools.apt.Strings.canonicalClassName;
import static org.apache.camel.tools.apt.Strings.getOrElse;
import static org.apache.camel.tools.apt.Strings.isNullOrEmpty;
+import static org.apache.camel.tools.apt.Strings.safeNull;
/**
* Processes all Camel {@link UriEndpoint}s and generate json schema and html documentation for the endpoint/component.
@@ -200,7 +201,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
// as its json we need to sanitize the docs
String doc = entry.getDocumentationWithNotes();
doc = sanitizeDescription(doc, false);
- buffer.append(JsonSchemaHelper.toJson(entry.getName(), "property", null, entry.getType(), entry.getDefaultValue(), doc, entry.isDeprecated(),
+ Boolean required = entry.getRequired() != null ? Boolean.valueOf(entry.getRequired()) : null;
+ buffer.append(JsonSchemaHelper.toJson(entry.getName(), "property", required, entry.getType(), entry.getDefaultValue(), doc, entry.isDeprecated(),
entry.isEnumType(), entry.getEnums(), false, null));
}
buffer.append("\n },");
@@ -215,7 +217,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
buffer.append(",");
}
buffer.append("\n ");
- buffer.append(JsonSchemaHelper.toJson(path.getName(), "path", null, path.getType(), "", path.getDocumentation(), path.isDeprecated(),
+ String doc = path.getDocumentation();
+ doc = sanitizeDescription(doc, false);
+ Boolean required = path.getRequired() != null ? Boolean.valueOf(path.getRequired()) : null;
+ buffer.append(JsonSchemaHelper.toJson(path.getName(), "path", required, path.getType(), null, doc, path.isDeprecated(),
path.isEnumType(), path.getEnums(), false, null));
}
@@ -230,7 +235,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
// as its json we need to sanitize the docs
String doc = entry.getDocumentationWithNotes();
doc = sanitizeDescription(doc, false);
- buffer.append(JsonSchemaHelper.toJson(entry.getName(), "parameter", null, entry.getType(), entry.getDefaultValue(), doc, entry.isDeprecated(),
+ Boolean required = entry.getRequired() != null ? Boolean.valueOf(entry.getRequired()) : null;
+ buffer.append(JsonSchemaHelper.toJson(entry.getName(), "parameter", required, entry.getType(), entry.getDefaultValue(), doc, entry.isDeprecated(),
entry.isEnumType(), entry.getEnums(), false, null));
}
buffer.append("\n }");
@@ -258,6 +264,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
writer.println(" <th>Name</th>");
writer.println(" <th>Kind</th>");
writer.println(" <th>Type</th>");
+ writer.println(" <th>Required</th>");
writer.println(" <th>Deprecated</th>");
writer.println(" <th>Default Value</th>");
writer.println(" <th>Enum Values</th>");
@@ -269,6 +276,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
writer.println(" <td>" + path.getName() + "</td>");
writer.println(" <td>" + "path" + "</td>");
writer.println(" <td>" + path.getType() + "</td>");
+ writer.println(" <td>" + safeNull(path.getRequired()) + "</td>");
writer.println(" <td>" + path.isDeprecated() + "</td>");
writer.println(" <td>" + path.getEnumValuesAsHtml() + "</td>");
writer.println(" <td>" + path.getDocumentation() + "</td>");
@@ -280,6 +288,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
writer.println(" <td>" + option.getName() + "</td>");
writer.println(" <td>" + "parameter" + "</td>");
writer.println(" <td>" + option.getType() + "</td>");
+ writer.println(" <td>" + safeNull(option.getRequired()) + "</td>");
writer.println(" <td>" + option.isDeprecated() + "</td>");
writer.println(" <td>" + option.getDefaultValue() + "</td>");
writer.println(" <td>" + option.getEnumValuesAsHtml() + "</td>");
@@ -372,7 +381,6 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
String fieldTypeName = fieldType.toString();
TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
-
// we do not yet have default values / notes / as no annotation support yet
// String defaultValueNote = param.defaultValueNote();
String defaultValue = metadata != null ? metadata.defaultValue() : null;
@@ -383,6 +391,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
docComment = "";
}
+ String required = metadata != null ? metadata.required() : null;
+
// gather enums
Set<String> enums = new LinkedHashSet<String>();
boolean isEnum = fieldTypeElement != null && fieldTypeElement.getKind() == ElementKind.ENUM;
@@ -398,7 +408,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
}
}
- ComponentOption option = new ComponentOption(name, fieldTypeName, defaultValue, defaultValueNote,
+ ComponentOption option = new ComponentOption(name, fieldTypeName, required, defaultValue, defaultValueNote,
docComment.trim(), deprecated, isEnum, enums);
componentOptions.add(option);
}
@@ -425,6 +435,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
List<VariableElement> fieldElements = ElementFilter.fieldsIn(classElement.getEnclosedElements());
for (VariableElement fieldElement : fieldElements) {
+ Metadata metadata = fieldElement.getAnnotation(Metadata.class);
boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;
UriPath path = fieldElement.getAnnotation(UriPath.class);
@@ -444,6 +455,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
docComment = path.description();
}
+ String required = metadata != null ? metadata.required() : null;
+
// gather enums
Set<String> enums = new LinkedHashSet<String>();
@@ -469,7 +482,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
}
}
- EndpointPath ep = new EndpointPath(name, fieldTypeName, docComment, deprecated, isEnum, enums);
+ EndpointPath ep = new EndpointPath(name, fieldTypeName, required, docComment, deprecated, isEnum, enums);
endpointPaths.add(ep);
}
@@ -506,6 +519,8 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
docComment = param.description();
}
+ String required = metadata != null ? metadata.required() : null;
+
// gather enums
Set<String> enums = new LinkedHashSet<String>();
@@ -531,7 +546,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
}
}
- EndpointOption option = new EndpointOption(name, fieldTypeName, defaultValue, defaultValueNote,
+ EndpointOption option = new EndpointOption(name, fieldTypeName, required, defaultValue, defaultValueNote,
docComment.trim(), deprecated, isEnum, enums);
endpointOptions.add(option);
}
@@ -638,6 +653,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
private String name;
private String type;
+ private String required;
private String defaultValue;
private String defaultValueNote;
private String documentation;
@@ -645,10 +661,11 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
private boolean enumType;
private Set<String> enums;
- private ComponentOption(String name, String type, String defaultValue, String defaultValueNote,
+ private ComponentOption(String name, String type, String required, String defaultValue, String defaultValueNote,
String documentation, boolean deprecated, boolean enumType, Set<String> enums) {
this.name = name;
this.type = type;
+ this.required = required;
this.defaultValue = defaultValue;
this.defaultValueNote = defaultValueNote;
this.documentation = documentation;
@@ -665,6 +682,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
return type;
}
+ public String getRequired() {
+ return required;
+ }
+
public String getDefaultValue() {
return defaultValue;
}
@@ -734,6 +755,7 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
private String name;
private String type;
+ private String required;
private String defaultValue;
private String defaultValueNote;
private String documentation;
@@ -741,10 +763,11 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
private boolean enumType;
private Set<String> enums;
- private EndpointOption(String name, String type, String defaultValue, String defaultValueNote,
+ private EndpointOption(String name, String type, String required, String defaultValue, String defaultValueNote,
String documentation, boolean deprecated, boolean enumType, Set<String> enums) {
this.name = name;
this.type = type;
+ this.required = required;
this.defaultValue = defaultValue;
this.defaultValueNote = defaultValueNote;
this.documentation = documentation;
@@ -761,6 +784,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
return type;
}
+ public String getRequired() {
+ return required;
+ }
+
public String getDefaultValue() {
return defaultValue;
}
@@ -830,15 +857,17 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
private String name;
private String type;
+ private String required;
private String documentation;
private boolean deprecated;
private boolean enumType;
private Set<String> enums;
- private EndpointPath(String name, String type, String documentation, boolean deprecated,
+ private EndpointPath(String name, String type, String required, String documentation, boolean deprecated,
boolean enumType, Set<String> enums) {
this.name = name;
this.type = type;
+ this.required = required;
this.documentation = documentation;
this.deprecated = deprecated;
this.enumType = enumType;
@@ -853,6 +882,10 @@ public class EndpointAnnotationProcessor extends AbstractAnnotationProcessor {
return type;
}
+ public String getRequired() {
+ return required;
+ }
+
public String getDocumentation() {
return documentation;
}
[2/2] camel git commit: CAMEL-8023: Model and component javadoc
documentation
Posted by da...@apache.org.
CAMEL-8023: Model and component javadoc documentation
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/06f6e1d6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/06f6e1d6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/06f6e1d6
Branch: refs/heads/master
Commit: 06f6e1d645af93ee3afe7f241184a71c3f4f5b06
Parents: 2a5dda6
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Feb 9 10:48:51 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Feb 9 10:48:51 2015 +0100
----------------------------------------------------------------------
.../component/validator/ValidatorEndpoint.java | 34 +++++++++++-
.../camel/component/xslt/XsltComponent.java | 18 ++++++
.../camel/component/xslt/XsltEndpoint.java | 58 +++++++++++++++++++-
3 files changed, 107 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/06f6e1d6/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
index 87bc68d..e8c7e2e 100644
--- a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorEndpoint.java
@@ -20,6 +20,7 @@ import java.io.InputStream;
import javax.xml.XMLConstants;
import javax.xml.validation.SchemaFactory;
+import org.apache.camel.spi.Metadata;
import org.w3c.dom.ls.LSResourceResolver;
import org.apache.camel.Component;
@@ -44,9 +45,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
private static final Logger LOG = LoggerFactory.getLogger(ValidatorEndpoint.class);
- @UriPath
+ @UriPath @Metadata(required = "true")
private String resourceUri;
- @UriParam
+ @UriParam(defaultValue = XMLConstants.W3C_XML_SCHEMA_NS_URI)
private String schemaLanguage = XMLConstants.W3C_XML_SCHEMA_NS_URI;
@UriParam
private SchemaFactory schemaFactory;
@@ -138,6 +139,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return schemaLanguage;
}
+ /**
+ * Configures the W3C XML Schema Namespace URI.
+ */
public void setSchemaLanguage(String schemaLanguage) {
this.schemaLanguage = schemaLanguage;
}
@@ -146,6 +150,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return schemaFactory;
}
+ /**
+ * To use a custom javax.xml.validation.SchemaFactory
+ */
public void setSchemaFactory(SchemaFactory schemaFactory) {
this.schemaFactory = schemaFactory;
}
@@ -154,6 +161,11 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return errorHandler;
}
+ /**
+ * To use a custom org.apache.camel.processor.validation.ValidatorErrorHandler.
+ * <p/>
+ * The default error handler captures the errors and throws an exception.
+ */
public void setErrorHandler(ValidatorErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
@@ -162,6 +174,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return useDom;
}
+ /**
+ * Whether DOMSource/DOMResult or SaxSource/SaxResult should be used by the validator.
+ */
public void setUseDom(boolean useDom) {
this.useDom = useDom;
}
@@ -170,6 +185,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return useSharedSchema;
}
+ /**
+ * Whether the Schema instance should be shared or not. This option is introduced to work around a JDK 1.6.x bug. Xerces should not have this issue.
+ */
public void setUseSharedSchema(boolean useSharedSchema) {
this.useSharedSchema = useSharedSchema;
}
@@ -178,6 +196,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return resourceResolver;
}
+ /**
+ * To use a custom LSResourceResolver
+ */
public void setResourceResolver(LSResourceResolver resourceResolver) {
this.resourceResolver = resourceResolver;
}
@@ -186,6 +207,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return failOnNullBody;
}
+ /**
+ * Whether to fail if no body exists.
+ */
public void setFailOnNullBody(boolean failOnNullBody) {
this.failOnNullBody = failOnNullBody;
}
@@ -194,6 +218,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return failOnNullHeader;
}
+ /**
+ * Whether to fail if no header exists when validating against a header.
+ */
public void setFailOnNullHeader(boolean failOnNullHeader) {
this.failOnNullHeader = failOnNullHeader;
}
@@ -202,6 +229,9 @@ public class ValidatorEndpoint extends DefaultEndpoint {
return headerName;
}
+ /**
+ * To validate against a header instead of the message body.
+ */
public void setHeaderName(String headerName) {
this.headerName = headerName;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/06f6e1d6/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
index 06e981c..427bed3 100644
--- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java
@@ -23,6 +23,7 @@ import org.apache.camel.Endpoint;
import org.apache.camel.builder.xml.XsltUriResolver;
import org.apache.camel.converter.jaxp.XmlConverter;
import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.util.ResourceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,7 +37,9 @@ public class XsltComponent extends UriEndpointComponent {
private XmlConverter xmlConverter;
private URIResolver uriResolver;
+ @Metadata(defaultValue = "true")
private boolean contentCache = true;
+ @Metadata(defaultValue = "false")
private boolean saxon;
public XsltComponent() {
@@ -47,6 +50,9 @@ public class XsltComponent extends UriEndpointComponent {
return xmlConverter;
}
+ /**
+ * To use a custom implementation of {@link org.apache.camel.converter.jaxp.XmlConverter}
+ */
public void setXmlConverter(XmlConverter xmlConverter) {
this.xmlConverter = xmlConverter;
}
@@ -55,6 +61,9 @@ public class XsltComponent extends UriEndpointComponent {
return uriResolver;
}
+ /**
+ * To use a custom javax.xml.transform.URIResolver
+ */
public void setUriResolver(URIResolver uriResolver) {
this.uriResolver = uriResolver;
}
@@ -63,6 +72,11 @@ public class XsltComponent extends UriEndpointComponent {
return contentCache;
}
+ /**
+ * Cache for the resource content (the stylesheet file) when it is loaded.
+ * If set to false Camel will reload the stylesheet file on each message processing. This is good for development.
+ * A cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation.
+ */
public void setContentCache(boolean contentCache) {
this.contentCache = contentCache;
}
@@ -71,6 +85,10 @@ public class XsltComponent extends UriEndpointComponent {
return saxon;
}
+ /**
+ * Whether to use Saxon as the transformerFactoryClass.
+ * If enabled then the class net.sf.saxon.TransformerFactoryImpl. You would need to add Saxon to the classpath.
+ */
public void setSaxon(boolean saxon) {
this.saxon = saxon;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/06f6e1d6/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
index da56d48..e8b16ec 100644
--- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
@@ -34,6 +34,7 @@ import org.apache.camel.builder.xml.ResultHandlerFactory;
import org.apache.camel.builder.xml.XsltBuilder;
import org.apache.camel.converter.jaxp.XmlConverter;
import org.apache.camel.impl.ProcessorEndpoint;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
@@ -53,7 +54,7 @@ public class XsltEndpoint extends ProcessorEndpoint {
private volatile XsltBuilder xslt;
private Map<String, Object> parameters;
- @UriPath
+ @UriPath @Metadata(required = "true")
private String resourceUri;
@UriParam(defaultValue = "true")
private boolean contentCache = true;
@@ -154,6 +155,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return resourceUri;
}
+ /**
+ * The name of the template to load from classpath or file system
+ */
public void setResourceUri(String resourceUri) {
this.resourceUri = resourceUri;
}
@@ -162,6 +166,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return converter;
}
+ /**
+ * To use a custom implementation of {@link org.apache.camel.converter.jaxp.XmlConverter}
+ */
public void setConverter(XmlConverter converter) {
this.converter = converter;
}
@@ -170,6 +177,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return transformerFactoryClass;
}
+ /**
+ * To use a custom XSLT transformer factory, specified as a FQN class name
+ */
public void setTransformerFactoryClass(String transformerFactoryClass) {
this.transformerFactoryClass = transformerFactoryClass;
}
@@ -178,6 +188,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return transformerFactory;
}
+ /**
+ * To use a custom XSLT transformer factory
+ */
public void setTransformerFactory(TransformerFactory transformerFactory) {
this.transformerFactory = transformerFactory;
}
@@ -186,6 +199,10 @@ public class XsltEndpoint extends ProcessorEndpoint {
return saxon;
}
+ /**
+ * Whether to use Saxon as the transformerFactoryClass.
+ * If enabled then the class net.sf.saxon.TransformerFactoryImpl. You would need to add Saxon to the classpath.
+ */
public void setSaxon(boolean saxon) {
this.saxon = saxon;
}
@@ -194,6 +211,10 @@ public class XsltEndpoint extends ProcessorEndpoint {
return resultHandlerFactory;
}
+ /**
+ * Allows you to use a custom org.apache.camel.builder.xml.ResultHandlerFactory which is capable of
+ * using custom org.apache.camel.builder.xml.ResultHandler types.
+ */
public void setResultHandlerFactory(ResultHandlerFactory resultHandlerFactory) {
this.resultHandlerFactory = resultHandlerFactory;
}
@@ -202,6 +223,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return failOnNullBody;
}
+ /**
+ * Whether or not to throw an exception if the input body is null.
+ */
public void setFailOnNullBody(boolean failOnNullBody) {
this.failOnNullBody = failOnNullBody;
}
@@ -210,6 +234,12 @@ public class XsltEndpoint extends ProcessorEndpoint {
return output;
}
+ /**
+ * Option to specify which output type to use.
+ * Possible values are: string, bytes, DOM, file. The first three options are all in memory based, where as file is streamed directly to a java.io.File.
+ * For file you must specify the filename in the IN header with the key Exchange.XSLT_FILE_NAME which is also CamelXsltFileName.
+ * Also any paths leading to the filename must be created beforehand, otherwise an exception is thrown at runtime.
+ */
public void setOutput(XsltOutput output) {
this.output = output;
}
@@ -218,6 +248,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return transformerCacheSize;
}
+ /**
+ * The number of javax.xml.transform.Transformer object that are cached for reuse to avoid calls to Template.newTransformer().
+ */
public void setTransformerCacheSize(int transformerCacheSize) {
this.transformerCacheSize = transformerCacheSize;
}
@@ -226,6 +259,11 @@ public class XsltEndpoint extends ProcessorEndpoint {
return errorListener;
}
+ /**
+ * Allows to configure to use a custom javax.xml.transform.ErrorListener. Beware when doing this then the default error
+ * listener which captures any errors or fatal errors and store information on the Exchange as properties is not in use.
+ * So only use this option for special use-cases.
+ */
public void setErrorListener(ErrorListener errorListener) {
this.errorListener = errorListener;
}
@@ -234,6 +272,11 @@ public class XsltEndpoint extends ProcessorEndpoint {
return contentCache;
}
+ /**
+ * Cache for the resource content (the stylesheet file) when it is loaded.
+ * If set to false Camel will reload the stylesheet file on each message processing. This is good for development.
+ * A cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation.
+ */
public void setContentCache(boolean contentCache) {
this.contentCache = contentCache;
}
@@ -242,6 +285,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return uriResolver;
}
+ /**
+ * To use a custom javax.xml.transform.URIResolver
+ */
public void setUriResolver(URIResolver uriResolver) {
this.uriResolver = uriResolver;
}
@@ -250,6 +296,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return allowStAX;
}
+ /**
+ * Whether to allow using StAX as the javax.xml.transform.Source.
+ */
public void setAllowStAX(boolean allowStAX) {
this.allowStAX = allowStAX;
}
@@ -258,6 +307,10 @@ public class XsltEndpoint extends ProcessorEndpoint {
return deleteOutputFile;
}
+ /**
+ * If you have output=file then this option dictates whether or not the output file should be deleted when the Exchange
+ * is done processing. For example suppose the output file is a temporary file, then it can be a good idea to delete it after use.
+ */
public void setDeleteOutputFile(boolean deleteOutputFile) {
this.deleteOutputFile = deleteOutputFile;
}
@@ -266,6 +319,9 @@ public class XsltEndpoint extends ProcessorEndpoint {
return parameters;
}
+ /**
+ * Additional parameters to configure on the javax.xml.transform.Transformer.
+ */
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
}