• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DataFormatDefinition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.camel.model.DataFormatDefinition的典型用法代码示例。如果您正苦于以下问题:Java DataFormatDefinition类的具体用法?Java DataFormatDefinition怎么用?Java DataFormatDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataFormatDefinition类属于org.apache.camel.model包,在下文中一共展示了DataFormatDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resolveUnmarshaller

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
/**
 * Find and configure an unmarshaller for the specified data format.
 */
private synchronized UnmarshalProcessor resolveUnmarshaller(
        Exchange exchange, String dataFormatId) throws Exception {
    
    if (unmarshaller == null) {
        DataFormat dataFormat = DataFormatDefinition.getDataFormat(
                exchange.getUnitOfWork().getRouteContext(), null, dataFormatId);
        if (dataFormat == null) {
            throw new Exception("Unable to resolve data format for unmarshalling: " + dataFormatId);
        }
        
        // Wrap the data format in a processor and start/configure it.  
        // Stop/shutdown is handled when the corresponding methods are 
        // called on this producer.
        unmarshaller = new UnmarshalProcessor(dataFormat);
        unmarshaller.setCamelContext(exchange.getContext());
        unmarshaller.start();
    }
    return unmarshaller;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:DozerProducer.java


示例2: resolveMarshaller

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
/**
 * Find and configure an unmarshaller for the specified data format.
 */
private synchronized MarshalProcessor resolveMarshaller(
        Exchange exchange, String dataFormatId) throws Exception {
    
    if (marshaller == null) {
        DataFormat dataFormat = DataFormatDefinition.getDataFormat(
                exchange.getUnitOfWork().getRouteContext(), null, dataFormatId);
        if (dataFormat == null) {
            throw new Exception("Unable to resolve data format for marshalling: " + dataFormatId);
        }
        
        // Wrap the data format in a processor and start/configure it.  
        // Stop/shutdown is handled when the corresponding methods are 
        // called on this producer.
        marshaller = new MarshalProcessor(dataFormat);
        marshaller.setCamelContext(exchange.getContext());
        marshaller.start();
    }
    return marshaller;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:DozerProducer.java


示例3: processCamelContextElement

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
private static List<RouteDefinition> processCamelContextElement(CamelContextFactoryBean camelContextFactoryBean, SwitchYardCamelContext camelContext) throws Exception {
    if (camelContext != null) {
        if (camelContextFactoryBean.getEndpoints() != null) {
            // processing camelContext/endpoint
            for (CamelEndpointFactoryBean epBean : camelContextFactoryBean.getEndpoints()) {
                epBean.setCamelContext(camelContext);
                camelContext.getWritebleRegistry().put(epBean.getId(), epBean.getObject());
            }
        }
        if (camelContextFactoryBean.getDataFormats() != null) {
            // processing camelContext/dataFormat
            for (DataFormatDefinition dataFormatDef : camelContextFactoryBean.getDataFormats().getDataFormats()) {
                camelContext.getDataFormats().put(dataFormatDef.getId(), dataFormatDef);
            }
        }
    }
    return camelContextFactoryBean.getRoutes();
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:19,代码来源:RouteFactory.java


示例4: createRouteBuilder

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            org.apache.camel.model.dataformat.XStreamDataFormat xstreamDataFormat = new org.apache.camel.model.dataformat.XStreamDataFormat();
            xstreamDataFormat.setConverters(Arrays.asList(new String[] {PersonConverter.class.getName()}));

            Map<String, DataFormatDefinition> dataFormats = new HashMap<String, DataFormatDefinition>();
            dataFormats.put("custom-xstream", xstreamDataFormat);
            getContext().setDataFormats(dataFormats);

            from("direct:test-with-session").policy(new KiePolicy()).unmarshal("xstream").to("kie:ksession1").marshal("xstream");
            from("direct:test-with-session-json").policy(new KiePolicy()).unmarshal("json").to("kie:ksession1").marshal("json");
            from("direct:test-no-session").policy(new KiePolicy()).unmarshal("xstream").to("kie:dynamic").marshal("xstream");
            from("direct:test-no-session-custom").policy(new KiePolicy()).unmarshal("custom-xstream").to("kie:dynamic").marshal("custom-xstream");
        }
    };
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:20,代码来源:CamelEndpointWithMarshallersTest.java


示例5: asMap

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
/***
 * @return A Map of the contained DataFormatType's indexed by id.
 */
public Map<String, DataFormatDefinition> asMap() {
    Map<String, DataFormatDefinition> dataFormatsAsMap = new HashMap<String, DataFormatDefinition>();
    for (DataFormatDefinition dataFormatType : getDataFormats()) {
        dataFormatsAsMap.put(dataFormatType.getId(), dataFormatType);
    }
    return dataFormatsAsMap;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:DataFormatsDefinition.java


示例6: resolveDataFormatDefinition

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
public DataFormatDefinition resolveDataFormatDefinition(String name) {
    // lookup type and create the data format from it
    DataFormatDefinition type = lookup(this, name, DataFormatDefinition.class);
    if (type == null && getDataFormats() != null) {
        type = getDataFormats().get(name);
    }
    return type;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:DefaultCamelContext.java


示例7: dataFormat

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private T dataFormat(DataFormatDefinition dataFormatType) {
    switch (operation) {
    case Unmarshal:
        return (T) processorType.unmarshal(dataFormatType);
    case Marshal:
        return (T) processorType.marshal(dataFormatType);
    default:
        throw new IllegalArgumentException("Unknown DataFormat operation: " + operation);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:DataFormatClause.java


示例8: dataFormat

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
private static ProcessorDefinition<?> dataFormat(DataFormatClause<?> self,
        DataFormatDefinition format) {
    try {
        Method m = self.getClass().getDeclaredMethod("dataFormat", DataFormatDefinition.class);
        m.setAccessible(true);
        return (ProcessorDefinition<?>) m.invoke(self, format);
    } catch (Exception e) {
        throw new IllegalArgumentException("Unknown DataFormat operation", e);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:CamelGroovyMethods.java


示例9: configureCamelContextXML

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
@Test
public void configureCamelContextXML() throws Exception {
    domain.setProperty(CamelContextConfigurator.CAMEL_CONTEXT_CONFIG_XML, PATH_CAMEL_CONTEXT_XML);
    
    Assert.assertNull(context.getProperty("abc"));
    Assert.assertNotEquals("foobar-camel-context", context.getName());
    Assert.assertEquals(false, context.isUseMDCLogging());
    Assert.assertEquals(ManagementStatisticsLevel.All
            , context.getManagementStrategy().getStatisticsLevel());
    Assert.assertEquals(true, context.isAllowUseOriginalMessage());
    Assert.assertEquals(false, context.isStreamCaching());
    
    context.start();
    
    Assert.assertNotNull(context.getProperty("abc"));
    Assert.assertEquals("xyz", context.getProperty("abc"));
    Assert.assertEquals("foobar-camel-context", context.getName());
    Assert.assertEquals(true, context.isUseMDCLogging());
    Assert.assertEquals(ManagementStatisticsLevel.RoutesOnly
            , context.getManagementStrategy().getStatisticsLevel());
    Assert.assertEquals(false, context.isAllowUseOriginalMessage());
    Assert.assertEquals(true, context.isStreamCaching());
    DataFormatDefinition dfd = context.getDataFormats().get("transform-json");
    Assert.assertNotNull(dfd);
    Assert.assertEquals("json-jackson", dfd.getDataFormatName());
    Assert.assertTrue(dfd instanceof JsonDataFormat);
    
    MockEndpoint mock = context.getEndpoint("mock:output", MockEndpoint.class);
    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived("foobar-input");
    context.createProducerTemplate().sendBody("direct:input", "foobar-input");
    mock.assertIsSatisfied();
    
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:35,代码来源:CamelContextConfiguratorTest.java


示例10: testConfiguration

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
@Test
public void testConfiguration() throws Exception {
    Assert.assertNotNull(_camelContext.getProperty("abc"));
    Assert.assertEquals("xyz", _camelContext.getProperty("abc"));
    Assert.assertEquals("foobar-camel-context", _camelContext.getName());
    Assert.assertEquals(true, _camelContext.isUseMDCLogging());
    Assert.assertEquals(ManagementStatisticsLevel.RoutesOnly
            , _camelContext.getManagementStrategy().getStatisticsLevel());
    Assert.assertEquals(false, _camelContext.isAllowUseOriginalMessage());
    Assert.assertEquals(true, _camelContext.isStreamCaching());
    DataFormatDefinition dfd = _camelContext.getDataFormats().get("transform-json");
    Assert.assertNotNull(dfd);
    Assert.assertEquals("json-jackson", dfd.getDataFormatName());
    Assert.assertTrue(dfd instanceof JsonDataFormat);
    
    MockEndpoint mock = _camelContext.getEndpoint("mock:output", MockEndpoint.class);
    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived("foobar-input");
    _camelContext.createProducerTemplate().sendBody("direct:input", "foobar-input");
    mock.assertIsSatisfied();
    
    // CamelContext should be able to find CDI beans produced by this class from registry.
    Assert.assertEquals(true, _camelContext.isTracing());
    DefaultTraceFormatter formatter =
            (DefaultTraceFormatter) ((Tracer)_camelContext.getDefaultTracer()).getFormatter();
    Assert.assertEquals(false, formatter.isShowBody());
    Assert.assertEquals(false, formatter.isShowBreadCrumb());
    Assert.assertEquals(100, formatter.getMaxChars());
    
    @SuppressWarnings("deprecation")
    ErrorHandlerBuilder builder = _camelContext.getErrorHandlerBuilder();
    Assert.assertEquals(ErrorHandlerBuilderRef.class, builder.getClass());
    Assert.assertEquals("foobarErrorHandler", ((ErrorHandlerBuilderRef)builder).getRef());
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:35,代码来源:DomainCamelContextConfigurationTest.java


示例11: AsynchRouteBuilder

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
private AsynchRouteBuilder(String inUri, ServiceExtEnum serviceType, String operation,
        AsynchResponseProcessor responseProcessor, DataFormatDefinition responseMarshalling) {
    Assert.hasText(operation, "the operation must not be empty");
    Assert.notNull(inUri, "the inUri must not be empty");
    Assert.notNull(serviceType, "the serviceType must not be null");
    Assert.notNull(responseProcessor, "the responseProcessor must not be null");
    Assert.notNull(responseMarshalling, "the responseMarshalling must not be null");

    this.inUri = inUri;
    this.serviceType = serviceType;
    this.operation = operation;
    this.responseProcessor = responseProcessor;
    this.responseMarshalling = responseMarshalling;
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:15,代码来源:AsynchRouteBuilder.java


示例12: withResponseProcessor

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
/**
 * Sets response processor. If not set then general response {@link AsynchResponse} will be used.
 *
 * @param responseProcessor   the response processor
 * @param responseMarshalling the response marshalling
 */
public AsynchRouteBuilder withResponseProcessor(AsynchResponseProcessor responseProcessor,
        DataFormatDefinition responseMarshalling) {
    Assert.notNull(responseProcessor, "the responseProcessor must not be null");
    Assert.notNull(responseMarshalling, "the responseMarshalling must not be null");

    this.responseProcessor = responseProcessor;
    this.responseMarshalling = responseMarshalling;
    return this;
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:16,代码来源:AsynchRouteBuilder.java


示例13: createDataFormat

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
@Override
protected DataFormat createDataFormat(RouteContext routeContext) {
    return DataFormatDefinition.getDataFormat(routeContext, null, ref);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:CustomDataFormat.java


示例14: setDataFormats

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
/**
 * A list holding the configured data formats
 */
public void setDataFormats(List<DataFormatDefinition> dataFormats) {
    this.dataFormats = dataFormats;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:DataFormatsDefinition.java


示例15: getDataFormats

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
public List<DataFormatDefinition> getDataFormats() {
    return dataFormats;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:DataFormatsDefinition.java


示例16: setDataFormats

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
public void setDataFormats(Map<String, DataFormatDefinition> dataFormats) {
    this.dataFormats = dataFormats;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:DefaultCamelContext.java


示例17: getDataFormats

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
public Map<String, DataFormatDefinition> getDataFormats() {
    return dataFormats;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:DefaultCamelContext.java


示例18: resolveDataFormatDefinition

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
public DataFormatDefinition resolveDataFormatDefinition(String name, CamelContext context) {
    return null;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:Activator.java


示例19: findDataFormat

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
private void findDataFormat(DataFormatDefinition dfd, Set<String> dataformats) {
    if (dfd != null && dfd.getDataFormatName() != null) {
        dataformats.add(dfd.getDataFormatName());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:CamelNamespaceHandler.java


示例20: slurper

import org.apache.camel.model.DataFormatDefinition; //导入依赖的package包/类
private static DataFormatDefinition slurper(boolean namespaceAware) {
    return new DataFormatDefinition(new XmlSlurperDataFormat(namespaceAware));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:CamelGroovyMethods.java



注:本文中的org.apache.camel.model.DataFormatDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WeiboAuth类代码示例发布时间:2022-05-23
下一篇:
Java PackageMaterialConfiguration类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap