Search in sources :

Example 6 with SubmitQueryRequest

use of org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest in project alliance by codice.

the class CatalogMgrImpl method submit_query.

@Override
public SubmitQueryRequest submit_query(Query aQuery, String[] result_attributes, SortAttribute[] sort_attributes, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
    BqsConverter bqsConverter = new BqsConverter(filterBuilder, removeSourceLibrary);
    SubmitQueryRequestImpl submitQueryRequest = new SubmitQueryRequestImpl(aQuery, filterBuilder, bqsConverter, catalogFramework, querySources);
    submitQueryRequest.set_number_of_hits(maxNumResults);
    submitQueryRequest.setTimeout(defaultTimeout);
    submitQueryRequest.setOutgoingValidationEnabled(outgoingValidationEnabled);
    submitQueryRequest.setResultAttributes(result_attributes);
    String queryId = UUID.randomUUID().toString();
    try {
        poa.activate_object_with_id(queryId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), submitQueryRequest);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
        LOGGER.debug("submit_query : Unable to activate submitQueryRequest object.", e);
    }
    org.omg.CORBA.Object obj = poa.create_reference_with_id(queryId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), SubmitQueryRequestHelper.id());
    SubmitQueryRequest queryRequest = SubmitQueryRequestHelper.narrow(obj);
    return queryRequest;
}
Also used : WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) SubmitQueryRequest(org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) BqsConverter(org.codice.alliance.nsili.common.BqsConverter) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) SubmitQueryRequestImpl(org.codice.alliance.nsili.endpoint.requests.SubmitQueryRequestImpl)

Example 7 with SubmitQueryRequest

use of org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest in project alliance by codice.

the class SampleNsiliClient method testCallbackCatalogMgr.

public void testCallbackCatalogMgr() throws Exception {
    if (catalogMgr != null) {
        LOGGER.info("Testing Query Results via Callback ...");
        SortAttribute[] sortAttributes = getSortableAttributes();
        String[] resultAttributes = getResultAttributes();
        LOGGER.info("Query: {}", STANDING_ALL_QUERY.bqs_query);
        SubmitQueryRequest catalogSearchQueryRequest = catalogMgr.submit_query(STANDING_ALL_QUERY, resultAttributes, sortAttributes, new NameValue[0]);
        catalogSearchQueryRequest.set_user_info(ALLIANCE);
        catalogSearchQueryRequest.set_number_of_hits(200);
        TestNsiliCallback nsiliCallback = new TestNsiliCallback(catalogSearchQueryRequest);
        byte[] poaObjId = poa.activate_object(nsiliCallback);
        org.omg.CORBA.Object obj = poa.id_to_reference(poaObjId);
        String catalogSearchCallbackID = catalogSearchQueryRequest.register_callback(CallbackHelper.narrow(obj));
        nsiliCallback.setCallbackID(catalogSearchCallbackID);
        callbacks.add(nsiliCallback);
        LOGGER.info("Callback Catalog Mgr Callback registered: {}", catalogSearchCallbackID);
    } else {
        LOGGER.warn("CatalogMgr is not initialized, unable to submit queries");
    }
}
Also used : SubmitQueryRequest(org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest) SortAttribute(org.codice.alliance.nsili.common.GIAS.SortAttribute)

Aggregations

SubmitQueryRequest (org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest)7 SortAttribute (org.codice.alliance.nsili.common.GIAS.SortAttribute)4 DAGListHolder (org.codice.alliance.nsili.common.UCO.DAGListHolder)4 HitCountRequest (org.codice.alliance.nsili.common.GIAS.HitCountRequest)2 IntHolder (org.omg.CORBA.IntHolder)2 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)2 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)2 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)2 Metacard (ddf.catalog.data.Metacard)1 Result (ddf.catalog.data.Result)1 ResultImpl (ddf.catalog.data.impl.ResultImpl)1 SourceResponseImpl (ddf.catalog.operation.impl.SourceResponseImpl)1 ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1 ScheduledFuture (java.util.concurrent.ScheduledFuture)1 BqsConverter (org.codice.alliance.nsili.common.BqsConverter)1 Query (org.codice.alliance.nsili.common.GIAS.Query)1 DAG (org.codice.alliance.nsili.common.UCO.DAG)1 InvalidInputParameter (org.codice.alliance.nsili.common.UCO.InvalidInputParameter)1