Skip to content

Add client factory and service lib for search and storage

Hong Yan requested to merge search-storage-client into master

Add client library for search service and storage service. It will not break any of our current pipeline.

Basic usage example

import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.model.search.CursorQueryRequest;
import org.opengroup.osdu.core.common.model.storage.Schema;
import org.opengroup.osdu.core.common.search.ISearchService;
import org.opengroup.osdu.core.common.search.SearchAPIConfig;
import org.opengroup.osdu.core.common.search.SearchFactory;
import org.opengroup.osdu.core.common.storage.IStorageService;
import org.opengroup.osdu.core.common.storage.StorageAPIConfig;
import org.opengroup.osdu.core.common.storage.StorageFactory;

...

        DpsHeaders headers = new DpsHeaders();
        headers.put(DpsHeaders.DATA_PARTITION_ID, "partition");
        headers.put(DpsHeaders.AUTHORIZATION, "token");
        headers.addCorrelationIdIfMissing();
        
        // Search Service
        SearchFactory searchFactory = new SearchFactory(SearchAPIConfig.builder().rootUrl("search url").apiKey("search apikey").build());
        ISearchService searchService = searchFactory.create(headers);
        searchService.searchCursor(new CursorQueryRequest());
      
        // Storage Service
        StorageFactory storageFactory = new StorageFactory(StorageAPIConfig.builder().rootUrl("storage url").apiKey("storage apikey").build());
        IStorageService storageService = storageFactory.create(headers);
        Schema schema = storageService.getSchema("kind");
Edited by Hong Yan

Merge request reports

Loading