All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.camel.component.olingo4.api.Olingo4App Maven / Gradle / Ivy

There is a newer version: 4.10.2
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel.component.olingo4.api;

import java.io.InputStream;
import java.util.List;
import java.util.Map;

import org.apache.camel.component.olingo4.api.batch.Olingo4BatchResponse;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.http.HttpStatusCode;

/**
 * Olingo4 Client Api Interface.
 */
public interface Olingo4App {

    /**
     * Sets Service base URI.
     *
     * @param serviceUri
     */
    void setServiceUri(String serviceUri);

    /**
     * Returns Service base URI.
     *
     * @return service base URI.
     */
    String getServiceUri();

    /**
     * Sets custom Http headers to add to every service request.
     *
     * @param httpHeaders custom Http headers.
     */
    void setHttpHeaders(Map httpHeaders);

    /**
     * Returns custom Http headers.
     *
     * @return custom Http headers.
     */
    Map getHttpHeaders();

    /**
     * Returns content type for service calls. Defaults to application/json;charset=utf-8.
     *
     * @return content type.
     */
    String getContentType();

    /**
     * Set default service call content type.
     *
     * @param contentType content type.
     */
    void setContentType(String contentType);

    /**
     * Closes resources.
     */
    void close();

    /**
     * Reads an OData resource and invokes callback with appropriate result.
     *
     * @param edm                 Service Edm, read from calling
     *                            read(null, "$metdata", null, responseHandler)
     * @param resourcePath        OData Resource path
     * @param queryParams         OData query params
     *                            http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc453752288
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param responseHandler     callback handler
     */
     void read(
            Edm edm, String resourcePath, Map queryParams, Map endpointHttpHeaders,
            Olingo4ResponseHandler responseHandler);

    /**
     * Reads an OData resource and invokes callback with the unparsed input stream.
     *
     * @param edm                 Service Edm, read from calling
     *                            read(null, "$metdata", null, responseHandler)
     * @param resourcePath        OData Resource path
     * @param queryParams         OData query params
     *                            http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc453752288
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param responseHandler     callback handler
     */
    void uread(
            Edm edm, String resourcePath, Map queryParams, Map endpointHttpHeaders,
            Olingo4ResponseHandler responseHandler);

    /**
     * Deletes an OData resource and invokes callback with {@link org.apache.olingo.commons.api.http.HttpStatusCode} on
     * success, or with exception on failure.
     *
     * @param resourcePath        resource path for Entry
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param responseHandler     {@link org.apache.olingo.commons.api.http.HttpStatusCode} callback handler
     */
    void delete(
            String resourcePath, Map endpointHttpHeaders,
            Olingo4ResponseHandler responseHandler);

    /**
     * Creates a new OData resource.
     *
     * @param edm                 service Edm
     * @param resourcePath        resource path to create
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param data                request data
     * @param responseHandler     callback handler
     */
     void create(
            Edm edm, String resourcePath, Map endpointHttpHeaders, Object data,
            Olingo4ResponseHandler responseHandler);

    /**
     * Updates an OData resource.
     *
     * @param edm                 service Edm
     * @param resourcePath        resource path to update
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param data                updated data
     * @param responseHandler     {@link org.apache.olingo.client.api.domain.ClientEntity} callback handler
     */
     void update(
            Edm edm, String resourcePath, Map endpointHttpHeaders, Object data,
            Olingo4ResponseHandler responseHandler);

    /**
     * Patches/merges an OData resource using HTTP PATCH.
     *
     * @param edm                 service Edm
     * @param resourcePath        resource path to update
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param data                patch/merge data
     * @param responseHandler     {@link org.apache.olingo.client.api.domain.ClientEntity} callback handler
     */
     void patch(
            Edm edm, String resourcePath, Map endpointHttpHeaders, Object data,
            Olingo4ResponseHandler responseHandler);

    /**
     * Patches/merges an OData resource using HTTP MERGE.
     *
     * @param edm                 service Edm
     * @param resourcePath        resource path to update
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param data                patch/merge data
     * @param responseHandler     {@link org.apache.olingo.client.api.domain.ClientEntity} callback handler
     */
     void merge(
            Edm edm, String resourcePath, Map endpointHttpHeaders, Object data,
            Olingo4ResponseHandler responseHandler);

    /**
     * Executes a batch request.
     *
     * @param edm                 service Edm
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param data                ordered {@link org.apache.camel.component.olingo4.api.batch.Olingo4BatchRequest} list
     * @param responseHandler     callback handler
     */
    void batch(
            Edm edm, Map endpointHttpHeaders, Object data,
            Olingo4ResponseHandler> responseHandler);

    /**
     * Calls a OData action
     *
     * @param edm                 service Edm
     * @param resourcePath        resource path to action
     * @param endpointHttpHeaders HTTP Headers to add/override the component versions
     * @param data                action data
     * @param responseHandler     {@link org.apache.olingo.client.api.domain.ClientEntity} callback handler
     */
     void action(
            Edm edm, String resourcePath, Map endpointHttpHeaders, Object data,
            Olingo4ResponseHandler responseHandler);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy