Search in sources :

Example 11 with WrongPolicy

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

the class LibraryImpl method getStandingQueryMgrObject.

private Object getStandingQueryMgrObject(String managerId) {
    Object obj;
    StandingQueryMgrImpl standingQueryMgr = new StandingQueryMgrImpl(querySources);
    standingQueryMgr.setCatalogFramework(catalogFramework);
    standingQueryMgr.setFilterBuilder(filterBuilder);
    standingQueryMgr.setDefaultUpdateFrequencyMsec(defaultUpdateFrequencyMsec);
    standingQueryMgr.setMaxPendingResults(maxPendingResults);
    standingQueryMgr.setRemoveSourceLibrary(removeSourceLibrary);
    standingQueryMgr.setOutgoingValidationEnabled(outgoingValidationEnabled);
    standingQueryMgr.setMaxWaitToStartTimeMsecs(maxWaitToStartTimeMsecs);
    if (!CorbaUtils.isIdActive(poa, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
        try {
            poa.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryMgr);
        } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
            LOGGER.info("Error activating StandingQueryMgr: ", e);
        }
    }
    obj = poa.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), StandingQueryMgrHelper.id());
    return obj;
}
Also used : WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) Object(org.omg.CORBA.Object) StandingQueryMgrImpl(org.codice.alliance.nsili.endpoint.managers.StandingQueryMgrImpl) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Example 12 with WrongPolicy

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

the class LibraryImpl method getDataModelMgrObject.

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

Example 13 with WrongPolicy

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

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

the class OrderRequestImpl method complete.

@Override
public State complete(DeliveryManifestHolder deliveryManifestHolder) throws ProcessingFault, SystemFault {
    DeliveryManifest deliveryManifest = new DeliveryManifest();
    List<PackageElement> packageElements = new ArrayList<>();
    if (!orderContainsSupportedDelivery()) {
        throw new NO_IMPLEMENT("Only HTTP(s) is supported");
    }
    try {
        String filename = null;
        PackagingSpecFormatType packageFormatType = PackagingSpecFormatType.FILESUNC;
        List<ResourceContainer> files = new ArrayList<>();
        if (order.prod_list == null) {
            throw new BAD_OPERATION("No products specified for the order");
        }
        for (ProductDetails productDetails : order.prod_list) {
            requestProductResource(files, productDetails);
        }
        if (order.pSpec != null) {
            PackagingSpec packagingSpec = order.pSpec;
            filename = packagingSpec.package_identifier;
            packageFormatType = PackagingSpecFormatType.valueOf(packagingSpec.packaging_format_and_compression);
        }
        if (order.del_list != null) {
            for (DeliveryDetails deliveryDetails : order.del_list) {
                Destination destination = deliveryDetails.dests;
                Optional<DestinationSink> destinationSink = destinationSinkFactory.apply(destination);
                if (destinationSink.isPresent()) {
                    List<String> filesSent = writeData(destinationSink.get(), packageFormatType, files, filename);
                    PackageElement packageElement = new PackageElement();
                    packageElement.files = filesSent.toArray(new String[filesSent.size()]);
                    packageElements.add(packageElement);
                }
            }
        }
    } catch (UnsupportedEncodingException | WrongAdapter | WrongPolicy e) {
        LOGGER.debug("Unable to get Metacard for product:", e);
    } catch (IOException | ExecutionException | SecurityServiceException e) {
        LOGGER.debug("Unable to retrieve resource:", e);
    }
    if (order.pSpec != null) {
        deliveryManifest.package_name = order.pSpec.package_identifier;
    }
    deliveryManifest.elements = packageElements.toArray(new PackageElement[packageElements.size()]);
    deliveryManifestHolder.value = deliveryManifest;
    return State.COMPLETED;
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) Destination(org.codice.alliance.nsili.common.GIAS.Destination) SecurityServiceException(ddf.security.service.SecurityServiceException) DeliveryDetails(org.codice.alliance.nsili.common.GIAS.DeliveryDetails) DeliveryManifest(org.codice.alliance.nsili.common.GIAS.DeliveryManifest) ArrayList(java.util.ArrayList) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) PackagingSpecFormatType(org.codice.alliance.nsili.common.PackagingSpecFormatType) ProductDetails(org.codice.alliance.nsili.common.GIAS.ProductDetails) PackagingSpec(org.codice.alliance.nsili.common.GIAS.PackagingSpec) ExecutionException(org.apache.shiro.subject.ExecutionException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) WrongAdapter(org.omg.PortableServer.POAPackage.WrongAdapter) PackageElement(org.codice.alliance.nsili.common.GIAS.PackageElement) BAD_OPERATION(org.omg.CORBA.BAD_OPERATION)

Example 15 with WrongPolicy

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

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