當前位置: 首頁>>代碼示例>>Java>>正文


Java Olingo4Configuration類代碼示例

本文整理匯總了Java中org.apache.camel.component.olingo4.Olingo4Configuration的典型用法代碼示例。如果您正苦於以下問題:Java Olingo4Configuration類的具體用法?Java Olingo4Configuration怎麽用?Java Olingo4Configuration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Olingo4Configuration類屬於org.apache.camel.component.olingo4包,在下文中一共展示了Olingo4Configuration類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createEndpointUri

import org.apache.camel.component.olingo4.Olingo4Configuration; //導入依賴的package包/類
@Override
public String createEndpointUri(final String scheme, final Map<String, String> options) throws URISyntaxException {

    // set serviceUri on delegate component
    Olingo4Component delegate = getCamelContext().getComponent(scheme, Olingo4Component.class);
    Olingo4Configuration configuration = new Olingo4Configuration();
    configuration.setServiceUri(this.serviceUri);
    delegate.setConfiguration(configuration);

    setAfterProducer( exchange -> {
        if (!exchange.isFailed()) {
            ClientEntity clientEntity = exchange.getIn().getBody(ClientEntity.class);
            if (clientEntity != null) {
                // convert client entity to JSON
                final StringWriter writer = new StringWriter();
                final Entity entity = odataClient.getBinder().getEntity(clientEntity);
                final ODataSerializer serializer = odataClient.getSerializer(APPLICATION_JSON);
                serializer.write(writer, entity);
                exchange.getIn().setBody(writer.toString());
            }
        }
        // TODO handle failure on missing resource 404
    });

    return super.createEndpointUri(scheme, options);
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:27,代碼來源:AbstractODataConnector.java

示例2: createCamelContext

import org.apache.camel.component.olingo4.Olingo4Configuration; //導入依賴的package包/類
private CamelContext createCamelContext() throws Exception {

        final CamelContext context = new DefaultCamelContext();

        Map<String, Object> options = new HashMap<String, Object>();
        options.put("serviceUri", getRealServiceUrl(TEST_SERVICE_BASE_URL));
        options.put("contentType", "application/json;charset=utf-8");

        final Olingo4Configuration configuration = new Olingo4Configuration();
        IntrospectionSupport.setProperties(configuration, options);

        // add OlingoComponent to Camel context
        final Olingo4Component component = new Olingo4Component(context);
        component.setConfiguration(configuration);
        context.addComponent("olingo4", component);

        return context;
    }
 
開發者ID:wildfly-extras,項目名稱:wildfly-camel,代碼行數:19,代碼來源:Olingo4IntegrationTest.java


注:本文中的org.apache.camel.component.olingo4.Olingo4Configuration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。