Search in sources :

Example 16 with WrongPolicy

use of org.omg.PortableServer.POAPackage.WrongPolicy 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 17 with WrongPolicy

use of org.omg.PortableServer.POAPackage.WrongPolicy 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 18 with WrongPolicy

use of org.omg.PortableServer.POAPackage.WrongPolicy 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)

Example 19 with WrongPolicy

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

the class SubmitStandingQueryRequestImpl method get_request_manager.

@Override
public RequestManager get_request_manager() throws ProcessingFault, SystemFault {
    if (requestManager == null) {
        String requestManagerId = UUID.randomUUID().toString();
        RequestManagerImpl requestManagerImpl = new RequestManagerImpl();
        try {
            _poa().activate_object_with_id(requestManagerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), requestManagerImpl);
        } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
            LOGGER.debug("Error activating RequestManager: ", e);
        }
        org.omg.CORBA.Object obj = _poa().create_reference_with_id(requestManagerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), RequestManagerHelper.id());
        requestManager = RequestManagerHelper.narrow(obj);
    }
    return requestManager;
}
Also used : WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) RequestManagerImpl(org.codice.alliance.nsili.endpoint.managers.RequestManagerImpl)

Example 20 with WrongPolicy

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

the class OrderMgrImplTest method setUp.

@Before
public void setUp() throws Exception {
    setupCommonMocks();
    setupOrderMgrMocks();
    try {
        setupOrb();
        orbRunThread = new Thread(() -> orb.run());
        orbRunThread.start();
    } catch (InvalidName | AdapterInactive | WrongPolicy | ServantNotActive e) {
        LOGGER.error("Unable to start the CORBA server", e);
    } catch (IOException e) {
        LOGGER.error("Unable to generate the IOR file", e);
    } catch (SecurityServiceException e) {
        LOGGER.error("Unable to setup guest security credentials", e);
    }
    String managerId = UUID.randomUUID().toString();
    orderMgr = new OrderMgrImpl();
    orderMgr.setFilterBuilder(new GeotoolsFilterBuilder());
    orderMgr.setCatalogFramework(mockCatalogFramework);
    if (!CorbaUtils.isIdActive(rootPOA, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
        try {
            rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), orderMgr);
        } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
            LOGGER.error("Error activating ProductMgr: {}", e);
        }
    }
    rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), ProductMgrHelper.id());
}
Also used : OrderMgrImpl(org.codice.alliance.nsili.endpoint.managers.OrderMgrImpl) SecurityServiceException(ddf.security.service.SecurityServiceException) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) ServantNotActive(org.omg.PortableServer.POAPackage.ServantNotActive) IOException(java.io.IOException) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) Before(org.junit.Before)

Aggregations

WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)28 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)25 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)25 IOException (java.io.IOException)9 SecurityServiceException (ddf.security.service.SecurityServiceException)7 InvalidName (org.omg.CORBA.ORBPackage.InvalidName)7 AdapterInactive (org.omg.PortableServer.POAManagerPackage.AdapterInactive)7 ServantNotActive (org.omg.PortableServer.POAPackage.ServantNotActive)7 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)6 Before (org.junit.Before)6 Object (org.omg.CORBA.Object)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 ArrayList (java.util.ArrayList)3 WrongAdapter (org.omg.PortableServer.POAPackage.WrongAdapter)3 Metacard (ddf.catalog.data.Metacard)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 Query (org.codice.alliance.nsili.common.GIAS.Query)2