Search in sources :

Example 1 with StandingQueryMgrImpl

use of org.codice.alliance.nsili.endpoint.managers.StandingQueryMgrImpl 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 2 with StandingQueryMgrImpl

use of org.codice.alliance.nsili.endpoint.managers.StandingQueryMgrImpl in project alliance by codice.

the class StandingQueryMgrImplTest method setUp.

@Before
public void setUp() throws Exception {
    setupCommonMocks();
    setupStandingQueryMgrMocks();
    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();
    standingQueryMgr = new StandingQueryMgrImpl(null);
    standingQueryMgr.setFilterBuilder(new GeotoolsFilterBuilder());
    standingQueryMgr.setCatalogFramework(mockCatalogFramework);
    standingQueryMgr.setDefaultUpdateFrequencyMsec(60000);
    standingQueryMgr.setMaxWaitToStartTimeMsecs(TimeUnit.MINUTES.toMillis(5));
    standingQueryMgr.setMaxPendingResults(10000);
    if (!CorbaUtils.isIdActive(rootPOA, managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)))) {
        try {
            rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryMgr);
        } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
            LOGGER.error("Error activating StandingQueryMgr: {}", e);
        }
    }
    rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), StandingQueryMgrHelper.id());
}
Also used : SecurityServiceException(ddf.security.service.SecurityServiceException) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) StandingQueryMgrImpl(org.codice.alliance.nsili.endpoint.managers.StandingQueryMgrImpl) 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

StandingQueryMgrImpl (org.codice.alliance.nsili.endpoint.managers.StandingQueryMgrImpl)2 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)2 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)2 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)2 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)1 SecurityServiceException (ddf.security.service.SecurityServiceException)1 IOException (java.io.IOException)1 Before (org.junit.Before)1 InvalidName (org.omg.CORBA.ORBPackage.InvalidName)1 Object (org.omg.CORBA.Object)1 AdapterInactive (org.omg.PortableServer.POAManagerPackage.AdapterInactive)1 ServantNotActive (org.omg.PortableServer.POAPackage.ServantNotActive)1