Search in sources :

Example 11 with ObjectAlreadyActive

use of org.omg.PortableServer.POAPackage.ObjectAlreadyActive in project alliance by codice.

the class LibraryImpl method getCreationMgrObject.

private Object getCreationMgrObject(String managerId) {
    Object obj;
    CreationMgrImpl creationMgr = new CreationMgrImpl();
    if (!CorbaUtils.isIdActive(poa, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
        try {
            poa.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), creationMgr);
        } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
            LOGGER.info("Error activating CreationMgr: ", e);
        }
    }
    obj = poa.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), CreationMgrHelper.id());
    return obj;
}
Also used : WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) CreationMgrImpl(org.codice.alliance.nsili.endpoint.managers.CreationMgrImpl) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) Object(org.omg.CORBA.Object) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Example 12 with ObjectAlreadyActive

use of org.omg.PortableServer.POAPackage.ObjectAlreadyActive in project alliance by codice.

the class CatalogMgrImpl method hit_count.

@Override
public HitCountRequest hit_count(Query aQuery, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
    // Force this to be an int per the NSILI API
    int numResults = (int) getResultCount(aQuery);
    HitCountRequestImpl hitCountRequest = new HitCountRequestImpl(numResults);
    String id = UUID.randomUUID().toString();
    try {
        poa.activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), hitCountRequest);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
        LOGGER.debug("hit_count : Unable to activate hitCountRequest object: {}", id, e);
    }
    org.omg.CORBA.Object obj = poa.create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), HitCountRequestHelper.id());
    HitCountRequest queryRequest = HitCountRequestHelper.narrow(obj);
    return queryRequest;
}
Also used : WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) HitCountRequestImpl(org.codice.alliance.nsili.endpoint.requests.HitCountRequestImpl) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) NsiliEndpoint(org.codice.alliance.nsili.endpoint.NsiliEndpoint) HitCountRequest(org.codice.alliance.nsili.common.GIAS.HitCountRequest)

Example 13 with ObjectAlreadyActive

use of org.omg.PortableServer.POAPackage.ObjectAlreadyActive in project alliance by codice.

the class OrderMgrImpl method order.

@Override
public OrderRequest order(OrderContents order, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
    String protocol = "http";
    int port = 80;
    for (NameValue prop : properties) {
        if (prop.aname.equals(NsiliConstants.PROP_PROTOCOL)) {
            protocol = DAGConverter.getString(prop.value);
        } else if (prop.aname.equals(NsiliConstants.PROP_PORT)) {
            Integer portInteger = DAGConverter.getInteger(prop.value);
            if (portInteger != null) {
                port = portInteger;
            }
        }
    }
    OrderRequestImpl orderRequestImpl = new OrderRequestImpl(order, protocol, port, getAccessManager(), catalogFramework, emailConfiguration);
    String id = UUID.randomUUID().toString();
    try {
        _poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), orderRequestImpl);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
        LOGGER.debug("order : Unable to activate orderRequest object.", e);
    }
    org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), OrderRequestHelper.id());
    OrderRequest orderRequest = OrderRequestHelper.narrow(obj);
    return orderRequest;
}
Also used : ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) OrderRequest(org.codice.alliance.nsili.common.GIAS.OrderRequest) NsiliEndpoint(org.codice.alliance.nsili.endpoint.NsiliEndpoint) NameValue(org.codice.alliance.nsili.common.UCO.NameValue) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) OrderRequestImpl(org.codice.alliance.nsili.endpoint.requests.OrderRequestImpl) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Example 14 with ObjectAlreadyActive

use of org.omg.PortableServer.POAPackage.ObjectAlreadyActive in project alliance by codice.

the class ProductMgrImpl method get_related_files.

@Override
public GetRelatedFilesRequest get_related_files(Product[] products, FileLocation location, String type, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
    String id = UUID.randomUUID().toString();
    try {
        List<Metacard> metacards = new ArrayList<>();
        AccessManagerImpl accessMgr = getAccessManager();
        for (Product product : products) {
            Metacard metacard = accessMgr.getMetacard(accessMgr.getProductId(product));
            if (metacard != null) {
                metacards.add(metacard);
            }
        }
        Integer port = getPort(properties);
        GetRelatedFilesRequestImpl getRelatedFilesRequest = new GetRelatedFilesRequestImpl(metacards, location, type, port);
        _poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), getRelatedFilesRequest);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy | WrongAdapter | UnsupportedEncodingException e) {
        LOGGER.debug("get_related_files : Unable to activate getRelatedFilesRequest object.", e);
    }
    org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), GetRelatedFilesRequestHelper.id());
    GetRelatedFilesRequest queryRequest = GetRelatedFilesRequestHelper.narrow(obj);
    return queryRequest;
}
Also used : GetRelatedFilesRequestImpl(org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) ArrayList(java.util.ArrayList) Product(org.codice.alliance.nsili.common.UID.Product) UnsupportedEncodingException(java.io.UnsupportedEncodingException) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) Metacard(ddf.catalog.data.Metacard) WrongAdapter(org.omg.PortableServer.POAPackage.WrongAdapter) GetRelatedFilesRequest(org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Example 15 with ObjectAlreadyActive

use of org.omg.PortableServer.POAPackage.ObjectAlreadyActive in project alliance by codice.

the class StandingQueryMgrImpl method submit_standing_query.

@Override
public SubmitStandingQueryRequest submit_standing_query(Query aQuery, String[] result_attributes, SortAttribute[] sort_attributes, QueryLifeSpan lifespan, NameValue[] properties) throws InvalidInputParameter, ProcessingFault, SystemFault {
    if (aQuery == null) {
        InvalidInputParameter except = new InvalidInputParameter();
        exception_details details = new exception_details();
        details.exception_name = "No Query Specified";
        details.exception_desc = "Query must be specified for standing query request";
        except.details = details;
        throw except;
    }
    LOGGER.debug("Registering Standing Query View: {}, BQS: {}", aQuery.view, aQuery.bqs_query);
    SubmitStandingQueryRequestImpl standingQueryRequest = new SubmitStandingQueryRequestImpl(aQuery, result_attributes, sort_attributes, lifespan, properties, catalogFramework, filterBuilder, defaultUpdateFrequencyMsec, querySources, maxPendingResults, removeSourceLibrary, outgoingValidationEnabled, maxWaitToStartTimeMsecs);
    String id = UUID.randomUUID().toString();
    try {
        _poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryRequest);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
        LOGGER.debug("submit_standing_query : Unable to activate submitStandingQueryRequest object.", e);
    }
    org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), SubmitStandingQueryRequestHelper.id());
    SubmitStandingQueryRequest submitStandingQueryRequest = SubmitStandingQueryRequestHelper.narrow(obj);
    return submitStandingQueryRequest;
}
Also used : SubmitStandingQueryRequest(org.codice.alliance.nsili.common.GIAS.SubmitStandingQueryRequest) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) UCO.exception_details(org.codice.alliance.nsili.common.UCO.exception_details) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) InvalidInputParameter(org.codice.alliance.nsili.common.UCO.InvalidInputParameter) SubmitStandingQueryRequestImpl(org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Aggregations

ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)25 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)25 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)25 IOException (java.io.IOException)6 Object (org.omg.CORBA.Object)6 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)5 SecurityServiceException (ddf.security.service.SecurityServiceException)5 Before (org.junit.Before)5 InvalidName (org.omg.CORBA.ORBPackage.InvalidName)5 AdapterInactive (org.omg.PortableServer.POAManagerPackage.AdapterInactive)5 ServantNotActive (org.omg.PortableServer.POAPackage.ServantNotActive)5 Metacard (ddf.catalog.data.Metacard)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ArrayList (java.util.ArrayList)2 GetParametersRequest (org.codice.alliance.nsili.common.GIAS.GetParametersRequest)2 GetRelatedFilesRequest (org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest)2 HitCountRequest (org.codice.alliance.nsili.common.GIAS.HitCountRequest)2 OrderRequest (org.codice.alliance.nsili.common.GIAS.OrderRequest)2 SubmitQueryRequest (org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest)2 NameValue (org.codice.alliance.nsili.common.UCO.NameValue)2