Skip to content

Commit

Permalink
CAMEL-13439: Resolving data formats is a bit cumbersome. So lets init…
Browse files Browse the repository at this point in the history
…ialize dataformats that has been setup via XML DSL or added as model, then they are ready to be used. Avoid using RouteContext as it was not needed and helps with modularization. Add some missing dataformats in the DSL.
  • Loading branch information
davsclaus committed Apr 23, 2019
1 parent 35b1bab commit 98db562
Show file tree
Hide file tree
Showing 26 changed files with 118 additions and 91 deletions.
2 changes: 1 addition & 1 deletion components/camel-dozer/pom.xml
Expand Up @@ -40,7 +40,7 @@
<!-- requires camel-core --> <!-- requires camel-core -->
<dependency> <dependency>
<groupId>org.apache.camel</groupId> <groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId> <artifactId>camel-support</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.dozermapper</groupId> <groupId>com.github.dozermapper</groupId>
Expand Down
Expand Up @@ -18,7 +18,6 @@


import org.apache.camel.Exchange; import org.apache.camel.Exchange;
import org.apache.camel.Message; import org.apache.camel.Message;
import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.spi.DataFormat; import org.apache.camel.spi.DataFormat;
import org.apache.camel.support.DefaultProducer; import org.apache.camel.support.DefaultProducer;
import org.apache.camel.support.processor.MarshalProcessor; import org.apache.camel.support.processor.MarshalProcessor;
Expand Down Expand Up @@ -129,8 +128,7 @@ private synchronized UnmarshalProcessor resolveUnmarshaller(
Exchange exchange, String dataFormatId) throws Exception { Exchange exchange, String dataFormatId) throws Exception {


if (unmarshaller == null) { if (unmarshaller == null) {
DataFormat dataFormat = DataFormatDefinition.getDataFormat( DataFormat dataFormat = exchange.getContext().resolveDataFormat(dataFormatId);
exchange.getUnitOfWork().getRouteContext(), null, dataFormatId);
if (dataFormat == null) { if (dataFormat == null) {
throw new Exception("Unable to resolve data format for unmarshalling: " + dataFormatId); throw new Exception("Unable to resolve data format for unmarshalling: " + dataFormatId);
} }
Expand All @@ -152,8 +150,7 @@ private synchronized MarshalProcessor resolveMarshaller(
Exchange exchange, String dataFormatId) throws Exception { Exchange exchange, String dataFormatId) throws Exception {


if (marshaller == null) { if (marshaller == null) {
DataFormat dataFormat = DataFormatDefinition.getDataFormat( DataFormat dataFormat = exchange.getContext().resolveDataFormat(dataFormatId);
exchange.getUnitOfWork().getRouteContext(), null, dataFormatId);
if (dataFormat == null) { if (dataFormat == null) {
throw new Exception("Unable to resolve data format for marshalling: " + dataFormatId); throw new Exception("Unable to resolve data format for marshalling: " + dataFormatId);
} }
Expand Down
Expand Up @@ -2555,6 +2555,7 @@ protected void doStartCamel() throws Exception {
} }


// Start runtime catalog // Start runtime catalog
// TODO: remove me as already started earlier
getExtension(RuntimeCamelCatalog.class); getExtension(RuntimeCamelCatalog.class);


// re-create endpoint registry as the cache size limit may be set after the constructor of this instance was called. // re-create endpoint registry as the cache size limit may be set after the constructor of this instance was called.
Expand Down Expand Up @@ -2590,6 +2591,16 @@ protected void doStartCamel() throws Exception {
propertiesComponent = existing; propertiesComponent = existing;
} }


// eager lookup data formats and bind to registry so the dataformats can be looked up and used
for (Map.Entry<String, DataFormatDefinition> e : dataFormats.entrySet()) {
String id = e.getKey();
DataFormatDefinition def = e.getValue();
log.debug("Creating Dataformat with id: {} and definition: {}", id, def);
DataFormat df = def.getDataFormat(this);
addService(df, true);
getRegistry().bind(id, df);
}

// start components // start components
startServices(components.values()); startServices(components.values());


Expand Down
Expand Up @@ -93,13 +93,16 @@ public void transform(Message message, DataType from, DataType to) throws Except
} }
} }


/**
* A bit dirty hack to create DataFormat instance, as it requires a RouteContext anyway.
*/
private DataFormat getDataFormat(Exchange exchange) throws Exception { private DataFormat getDataFormat(Exchange exchange) throws Exception {
// TODO: Move this to doStart and remove this method
if (this.dataFormat == null) { if (this.dataFormat == null) {
this.dataFormat = DataFormatDefinition.getDataFormat( if (this.dataFormatType != null) {
exchange.getUnitOfWork().getRouteContext(), this.dataFormatType, this.dataFormatRef); this.dataFormat = this.dataFormatType.getDataFormat(exchange.getContext());
} else if (this.dataFormatRef != null) {
this.dataFormat = exchange.getContext().resolveDataFormat(this.dataFormatRef);
}
// this.dataFormat = DataFormatDefinition.getDataFormat(
// exchange.getContext(), this.dataFormatType, this.dataFormatRef);
if (this.dataFormat != null && !getCamelContext().hasService(this.dataFormat)) { if (this.dataFormat != null && !getCamelContext().hasService(this.dataFormat)) {
getCamelContext().addService(this.dataFormat, false); getCamelContext().addService(this.dataFormat, false);
} }
Expand Down
Expand Up @@ -29,11 +29,8 @@
import org.apache.camel.CamelContext; import org.apache.camel.CamelContext;
import org.apache.camel.spi.DataFormat; import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.Metadata; import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.support.IntrospectionSupport; import org.apache.camel.support.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.ObjectHelper;


import static org.apache.camel.support.EndpointHelper.isReferenceParameter; import static org.apache.camel.support.EndpointHelper.isReferenceParameter;


/** /**
Expand Down Expand Up @@ -67,55 +64,55 @@ protected DataFormatDefinition(String dataFormatName) {
/** /**
* Factory method to create the data format * Factory method to create the data format
* *
* @param routeContext route context * @param camelContext the camel context
* @param type the data format type * @param type the data format type
* @param ref reference to lookup for a data format * @param ref reference to lookup for a data format
* @return the data format or null if not possible to create * @return the data format or null if not possible to create
*/ */
public static DataFormat getDataFormat(RouteContext routeContext, DataFormatDefinition type, String ref) { public static DataFormat getDataFormat(CamelContext camelContext, DataFormatDefinition type, String ref) {
if (type == null) { if (type == null) {
ObjectHelper.notNull(ref, "ref or type"); ObjectHelper.notNull(ref, "ref or type");


// try to let resolver see if it can resolve it, its not always possible // try to let resolver see if it can resolve it, its not always possible
type = routeContext.getCamelContext().adapt(ModelCamelContext.class).resolveDataFormatDefinition(ref); type = camelContext.adapt(ModelCamelContext.class).resolveDataFormatDefinition(ref);


if (type != null) { if (type != null) {
return type.getDataFormat(routeContext); return type.getDataFormat(camelContext);
} }


DataFormat dataFormat = routeContext.getCamelContext().resolveDataFormat(ref); DataFormat dataFormat = camelContext.resolveDataFormat(ref);
if (dataFormat == null) { if (dataFormat == null) {
throw new IllegalArgumentException("Cannot find data format in registry with ref: " + ref); throw new IllegalArgumentException("Cannot find data format in registry with ref: " + ref);
} }


return dataFormat; return dataFormat;
} else { } else {
return type.getDataFormat(routeContext); return type.getDataFormat(camelContext);
} }
} }


public DataFormat getDataFormat(RouteContext routeContext) { public DataFormat getDataFormat(CamelContext camelContext) {
if (dataFormat == null) { if (dataFormat == null) {
Runnable propertyPlaceholdersChangeReverter = ProcessorDefinitionHelper.createPropertyPlaceholdersChangeReverter(); Runnable propertyPlaceholdersChangeReverter = ProcessorDefinitionHelper.createPropertyPlaceholdersChangeReverter();


// resolve properties before we create the data format // resolve properties before we create the data format
try { try {
ProcessorDefinitionHelper.resolvePropertyPlaceholders(routeContext.getCamelContext(), this); ProcessorDefinitionHelper.resolvePropertyPlaceholders(camelContext, this);
} catch (Exception e) { } catch (Exception e) {
throw new IllegalArgumentException("Error resolving property placeholders on data format: " + this, e); throw new IllegalArgumentException("Error resolving property placeholders on data format: " + this, e);
} }
try { try {
dataFormat = createDataFormat(routeContext); dataFormat = createDataFormat(camelContext);
if (dataFormat != null) { if (dataFormat != null) {
// is enabled by default so assume true if null // is enabled by default so assume true if null
final boolean contentTypeHeader = this.contentTypeHeader == null || this.contentTypeHeader; final boolean contentTypeHeader = this.contentTypeHeader == null || this.contentTypeHeader;
try { try {
setProperty(routeContext.getCamelContext(), dataFormat, "contentTypeHeader", contentTypeHeader); setProperty(camelContext, dataFormat, "contentTypeHeader", contentTypeHeader);
} catch (Exception e) { } catch (Exception e) {
// ignore as this option is optional and not all data formats support this // ignore as this option is optional and not all data formats support this
} }
// configure the rest of the options // configure the rest of the options
configureDataFormat(dataFormat, routeContext.getCamelContext()); configureDataFormat(dataFormat, camelContext);
} else { } else {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Data format '" + (dataFormatName != null ? dataFormatName : "<null>") + "' could not be created. " "Data format '" + (dataFormatName != null ? dataFormatName : "<null>") + "' could not be created. "
Expand All @@ -131,10 +128,10 @@ public DataFormat getDataFormat(RouteContext routeContext) {
/** /**
* Factory method to create the data format instance * Factory method to create the data format instance
*/ */
protected DataFormat createDataFormat(RouteContext routeContext) { protected DataFormat createDataFormat(CamelContext camelContext) {
// must use getDataFormatName() as we need special logic in json dataformat // must use getDataFormatName() as we need special logic in json dataformat
if (getDataFormatName() != null) { if (getDataFormatName() != null) {
return routeContext.getCamelContext().createDataFormat(getDataFormatName()); return camelContext.createDataFormat(getDataFormatName());
} }
return null; return null;
} }
Expand Down
Expand Up @@ -24,6 +24,7 @@


import org.apache.camel.model.dataformat.ASN1DataFormat; import org.apache.camel.model.dataformat.ASN1DataFormat;
import org.apache.camel.model.dataformat.AvroDataFormat; import org.apache.camel.model.dataformat.AvroDataFormat;
import org.apache.camel.model.dataformat.BarcodeDataFormat;
import org.apache.camel.model.dataformat.Base64DataFormat; import org.apache.camel.model.dataformat.Base64DataFormat;
import org.apache.camel.model.dataformat.BeanioDataFormat; import org.apache.camel.model.dataformat.BeanioDataFormat;
import org.apache.camel.model.dataformat.BindyDataFormat; import org.apache.camel.model.dataformat.BindyDataFormat;
Expand All @@ -42,6 +43,8 @@
import org.apache.camel.model.dataformat.JibxDataFormat; import org.apache.camel.model.dataformat.JibxDataFormat;
import org.apache.camel.model.dataformat.JsonApiDataFormat; import org.apache.camel.model.dataformat.JsonApiDataFormat;
import org.apache.camel.model.dataformat.JsonDataFormat; import org.apache.camel.model.dataformat.JsonDataFormat;
import org.apache.camel.model.dataformat.LZFDataFormat;
import org.apache.camel.model.dataformat.MimeMultipartDataFormat;
import org.apache.camel.model.dataformat.PGPDataFormat; import org.apache.camel.model.dataformat.PGPDataFormat;
import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.ProtobufDataFormat;
import org.apache.camel.model.dataformat.RssDataFormat; import org.apache.camel.model.dataformat.RssDataFormat;
Expand Down Expand Up @@ -74,6 +77,7 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> {
@XmlElements({ @XmlElements({
@XmlElement(required = false, name = "asn1", type = ASN1DataFormat.class), @XmlElement(required = false, name = "asn1", type = ASN1DataFormat.class),
@XmlElement(required = false, name = "avro", type = AvroDataFormat.class), @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
@XmlElement(required = false, name = "barcode", type = BarcodeDataFormat.class),
@XmlElement(required = false, name = "base64", type = Base64DataFormat.class), @XmlElement(required = false, name = "base64", type = Base64DataFormat.class),
@XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class), @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
@XmlElement(required = false, name = "bindy", type = BindyDataFormat.class), @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
Expand All @@ -92,6 +96,8 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> {
@XmlElement(required = false, name = "jibx", type = JibxDataFormat.class), @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
@XmlElement(required = false, name = "json", type = JsonDataFormat.class), @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
@XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class), @XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class),
@XmlElement(required = false, name = "lzf", type = LZFDataFormat.class),
@XmlElement(required = false, name = "mimeMultipart", type = MimeMultipartDataFormat.class),
@XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class), @XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class),
@XmlElement(required = false, name = "rss", type = RssDataFormat.class), @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
@XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class), @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
Expand Down
Expand Up @@ -24,6 +24,7 @@


import org.apache.camel.model.dataformat.ASN1DataFormat; import org.apache.camel.model.dataformat.ASN1DataFormat;
import org.apache.camel.model.dataformat.AvroDataFormat; import org.apache.camel.model.dataformat.AvroDataFormat;
import org.apache.camel.model.dataformat.BarcodeDataFormat;
import org.apache.camel.model.dataformat.Base64DataFormat; import org.apache.camel.model.dataformat.Base64DataFormat;
import org.apache.camel.model.dataformat.BeanioDataFormat; import org.apache.camel.model.dataformat.BeanioDataFormat;
import org.apache.camel.model.dataformat.BindyDataFormat; import org.apache.camel.model.dataformat.BindyDataFormat;
Expand All @@ -42,6 +43,8 @@
import org.apache.camel.model.dataformat.JibxDataFormat; import org.apache.camel.model.dataformat.JibxDataFormat;
import org.apache.camel.model.dataformat.JsonApiDataFormat; import org.apache.camel.model.dataformat.JsonApiDataFormat;
import org.apache.camel.model.dataformat.JsonDataFormat; import org.apache.camel.model.dataformat.JsonDataFormat;
import org.apache.camel.model.dataformat.LZFDataFormat;
import org.apache.camel.model.dataformat.MimeMultipartDataFormat;
import org.apache.camel.model.dataformat.PGPDataFormat; import org.apache.camel.model.dataformat.PGPDataFormat;
import org.apache.camel.model.dataformat.ProtobufDataFormat; import org.apache.camel.model.dataformat.ProtobufDataFormat;
import org.apache.camel.model.dataformat.RssDataFormat; import org.apache.camel.model.dataformat.RssDataFormat;
Expand Down Expand Up @@ -74,6 +77,7 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition>
@XmlElements({ @XmlElements({
@XmlElement(required = false, name = "asn1", type = ASN1DataFormat.class), @XmlElement(required = false, name = "asn1", type = ASN1DataFormat.class),
@XmlElement(required = false, name = "avro", type = AvroDataFormat.class), @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
@XmlElement(required = false, name = "barcode", type = BarcodeDataFormat.class),
@XmlElement(required = false, name = "base64", type = Base64DataFormat.class), @XmlElement(required = false, name = "base64", type = Base64DataFormat.class),
@XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class), @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
@XmlElement(required = false, name = "bindy", type = BindyDataFormat.class), @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
Expand All @@ -92,6 +96,8 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition>
@XmlElement(required = false, name = "jibx", type = JibxDataFormat.class), @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
@XmlElement(required = false, name = "json", type = JsonDataFormat.class), @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
@XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class), @XmlElement(required = false, name = "jsonApi", type = JsonApiDataFormat.class),
@XmlElement(required = false, name = "lzf", type = LZFDataFormat.class),
@XmlElement(required = false, name = "mimeMultipart", type = MimeMultipartDataFormat.class),
@XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class), @XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class),
@XmlElement(required = false, name = "rss", type = RssDataFormat.class), @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
@XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class), @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
Expand Down
Expand Up @@ -104,7 +104,8 @@ public void setUnwrapSingleInstance(Boolean unwrapSingleInstance) {
this.unwrapSingleInstance = unwrapSingleInstance; this.unwrapSingleInstance = unwrapSingleInstance;
} }


protected DataFormat createDataFormat(RouteContext routeContext) { @Override
protected DataFormat createDataFormat(CamelContext camelContext) {
if (classType == null && clazz == null) { if (classType == null && clazz == null) {
throw new IllegalArgumentException("Either packages or classType must be specified"); throw new IllegalArgumentException("Either packages or classType must be specified");
} }
Expand All @@ -119,12 +120,12 @@ protected DataFormat createDataFormat(RouteContext routeContext) {


if (clazz == null && classType != null) { if (clazz == null && classType != null) {
try { try {
clazz = routeContext.getCamelContext().getClassResolver().resolveMandatoryClass(classType); clazz = camelContext.getClassResolver().resolveMandatoryClass(classType);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw RuntimeCamelException.wrapRuntimeCamelException(e); throw RuntimeCamelException.wrapRuntimeCamelException(e);
} }
} }
return super.createDataFormat(routeContext); return super.createDataFormat(camelContext);
} }


@Override @Override
Expand Down
Expand Up @@ -87,15 +87,15 @@ public void setUseList(boolean useList) {
} }


@Override @Override
protected DataFormat createDataFormat(RouteContext routeContext) { protected DataFormat createDataFormat(CamelContext camelContext) {
if (unmarshalType == null && unmarshalTypeName != null) { if (unmarshalType == null && unmarshalTypeName != null) {
try { try {
unmarshalType = routeContext.getCamelContext().getClassResolver().resolveMandatoryClass(unmarshalTypeName); unmarshalType = camelContext.getClassResolver().resolveMandatoryClass(unmarshalTypeName);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw RuntimeCamelException.wrapRuntimeCamelException(e); throw RuntimeCamelException.wrapRuntimeCamelException(e);
} }
} }
return super.createDataFormat(routeContext); return super.createDataFormat(camelContext);
} }


@Override @Override
Expand Down
Expand Up @@ -63,21 +63,21 @@ public CryptoDataFormat() {
} }


@Override @Override
protected DataFormat createDataFormat(RouteContext routeContext) { protected DataFormat createDataFormat(CamelContext camelContext) {
DataFormat cryptoFormat = super.createDataFormat(routeContext); DataFormat cryptoFormat = super.createDataFormat(camelContext);


if (ObjectHelper.isNotEmpty(keyRef)) { if (ObjectHelper.isNotEmpty(keyRef)) {
Key key = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), keyRef, Key.class); Key key = CamelContextHelper.mandatoryLookup(camelContext, keyRef, Key.class);
setProperty(routeContext.getCamelContext(), cryptoFormat, "key", key); setProperty(camelContext, cryptoFormat, "key", key);
} }
if (ObjectHelper.isNotEmpty(algorithmParameterRef)) { if (ObjectHelper.isNotEmpty(algorithmParameterRef)) {
AlgorithmParameterSpec spec = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), AlgorithmParameterSpec spec = CamelContextHelper.mandatoryLookup(camelContext,
algorithmParameterRef, AlgorithmParameterSpec.class); algorithmParameterRef, AlgorithmParameterSpec.class);
setProperty(routeContext.getCamelContext(), cryptoFormat, "AlgorithmParameterSpec", spec); setProperty(camelContext, cryptoFormat, "AlgorithmParameterSpec", spec);
} }
if (ObjectHelper.isNotEmpty(initVectorRef)) { if (ObjectHelper.isNotEmpty(initVectorRef)) {
byte[] iv = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), initVectorRef, byte[].class); byte[] iv = CamelContextHelper.mandatoryLookup(camelContext, initVectorRef, byte[].class);
setProperty(routeContext.getCamelContext(), cryptoFormat, "InitializationVector", iv); setProperty(camelContext, cryptoFormat, "InitializationVector", iv);
} }
return cryptoFormat; return cryptoFormat;
} }
Expand Down
Expand Up @@ -21,10 +21,10 @@
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;


import org.apache.camel.CamelContext;
import org.apache.camel.model.DataFormatDefinition; import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.spi.DataFormat; import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.Metadata; import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.RouteContext;


/** /**
* To use a custom data format implementation that does not come out of the box from Apache Camel. * To use a custom data format implementation that does not come out of the box from Apache Camel.
Expand All @@ -44,8 +44,8 @@ public CustomDataFormat(String ref) {
} }


@Override @Override
protected DataFormat createDataFormat(RouteContext routeContext) { protected DataFormat createDataFormat(CamelContext camelContext) {
return DataFormatDefinition.getDataFormat(routeContext, null, ref); return DataFormatDefinition.getDataFormat(camelContext, null, ref);
} }


/** /**
Expand Down
Expand Up @@ -151,12 +151,12 @@ public void setParserFactoryRef(String parserFactoryRef) {
} }


@Override @Override
protected DataFormat createDataFormat(RouteContext routeContext) { protected DataFormat createDataFormat(CamelContext camelContext) {
DataFormat flatpack = super.createDataFormat(routeContext); DataFormat flatpack = super.createDataFormat(camelContext);


if (ObjectHelper.isNotEmpty(parserFactoryRef)) { if (ObjectHelper.isNotEmpty(parserFactoryRef)) {
Object parserFactory = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), parserFactoryRef); Object parserFactory = CamelContextHelper.mandatoryLookup(camelContext, parserFactoryRef);
setProperty(routeContext.getCamelContext(), flatpack, "parserFactory", parserFactory); setProperty(camelContext, flatpack, "parserFactory", parserFactory);
} }


return flatpack; return flatpack;
Expand Down
Expand Up @@ -18,6 +18,7 @@


import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;


import org.apache.camel.CamelContext;
import org.apache.camel.model.DataFormatDefinition; import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.spi.DataFormat; import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.Metadata; import org.apache.camel.spi.Metadata;
Expand All @@ -35,7 +36,7 @@ public GzipDataFormat() {
} }


@Override @Override
protected DataFormat createDataFormat(RouteContext routeContext) { protected DataFormat createDataFormat(CamelContext camelContext) {
return new org.apache.camel.impl.GzipDataFormat(); return new org.apache.camel.impl.GzipDataFormat();
} }
} }

0 comments on commit 98db562

Please sign in to comment.