Search in sources :

Example 1 with LibraryManager

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

the class LibraryImpl method get_manager.

@Override
public LibraryManager get_manager(String manager_type, AccessCriteria access_criteria) throws ProcessingFault, InvalidInputParameter, SystemFault {
    org.omg.CORBA.Object obj;
    switch(manager_type) {
        case "CatalogMgr":
            CatalogMgrImpl catalogMgr = new CatalogMgrImpl(poa_);
            try {
                poa_.activate_object_with_id(manager_type.getBytes(Charset.forName(ENCODING)), catalogMgr);
            } catch (Exception e) {
            // Ignore
            }
            obj = poa_.create_reference_with_id(manager_type.getBytes(Charset.forName(ENCODING)), CatalogMgrHelper.id());
            break;
        case "OrderMgr":
            OrderMgrImpl orderMgr = new OrderMgrImpl();
            try {
                poa_.activate_object_with_id(manager_type.getBytes(Charset.forName(ENCODING)), orderMgr);
            } catch (Exception e) {
            // Ignore
            }
            obj = poa_.create_reference_with_id(manager_type.getBytes(Charset.forName(ENCODING)), OrderMgrHelper.id());
            break;
        case "ProductMgr":
            ProductMgrImpl productMgr = new ProductMgrImpl();
            try {
                poa_.activate_object_with_id(manager_type.getBytes(Charset.forName(ENCODING)), productMgr);
            } catch (Exception e) {
            // Ignore
            }
            obj = poa_.create_reference_with_id(manager_type.getBytes(Charset.forName(ENCODING)), ProductMgrHelper.id());
            break;
        case "DataModelMgr":
            DataModelMgrImpl dataModelMgr = new DataModelMgrImpl();
            try {
                poa_.activate_object_with_id(manager_type.getBytes(Charset.forName(ENCODING)), dataModelMgr);
            } catch (Exception e) {
            // Ignore
            }
            obj = poa_.create_reference_with_id(manager_type.getBytes(Charset.forName(ENCODING)), DataModelMgrHelper.id());
            break;
        default:
            String[] bad_params = { manager_type };
            throw new InvalidInputParameter("UnknownMangerType", new exception_details("UnknownMangerType", true, manager_type), bad_params);
    }
    LibraryManager libraryManager = LibraryManagerHelper.narrow(obj);
    return libraryManager;
}
Also used : OrderMgrImpl(org.codice.alliance.nsili.mockserver.impl.managers.OrderMgrImpl) DataModelMgrImpl(org.codice.alliance.nsili.mockserver.impl.managers.DataModelMgrImpl) ProductMgrImpl(org.codice.alliance.nsili.mockserver.impl.managers.ProductMgrImpl) UCO.exception_details(org.codice.alliance.nsili.common.UCO.exception_details) LibraryManager(org.codice.alliance.nsili.common.GIAS.LibraryManager) CatalogMgrImpl(org.codice.alliance.nsili.mockserver.impl.managers.CatalogMgrImpl) InvalidInputParameter(org.codice.alliance.nsili.common.UCO.InvalidInputParameter)

Example 2 with LibraryManager

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

the class NsiliSource method initMandatoryManagers.

/**
 * Initializes all STANAG 4559 mandatory managers: CatalogMgr OrderMgr DataModelMgr ProductMgr
 */
private void initMandatoryManagers() {
    try {
        accessCriteria = new AccessCriteria(accessUserId, accessPassword, accessLicenseKey);
        LibraryManager libraryManager = library.get_manager(CATALOG_MGR, accessCriteria);
        setCatalogMgr(CatalogMgrHelper.narrow(libraryManager));
        libraryManager = library.get_manager(ORDER_MGR, accessCriteria);
        setOrderMgr(OrderMgrHelper.narrow(libraryManager));
        libraryManager = library.get_manager(PRODUCT_MGR, accessCriteria);
        setProductMgr(ProductMgrHelper.narrow(libraryManager));
        libraryManager = library.get_manager(DATA_MODEL_MGR, accessCriteria);
        setDataModelMgr(DataModelMgrHelper.narrow(libraryManager));
    } catch (ProcessingFault | SystemFault | InvalidInputParameter e) {
        LOGGER.debug("{} : Unable to retrieve mandatory managers.", sourceId, e);
    }
    if (catalogMgr != null && orderMgr != null && productMgr != null && dataModelMgr != null) {
        LOGGER.debug("{} : Initialized STANAG mandatory managers.", getId());
    } else {
        LOGGER.debug("{} : Unable to initialize mandatory mangers.", getId());
    }
}
Also used : SystemFault(org.codice.alliance.nsili.common.UCO.SystemFault) LibraryManager(org.codice.alliance.nsili.common.GIAS.LibraryManager) AccessCriteria(org.codice.alliance.nsili.common.GIAS.AccessCriteria) InvalidInputParameter(org.codice.alliance.nsili.common.UCO.InvalidInputParameter) ProcessingFault(org.codice.alliance.nsili.common.UCO.ProcessingFault)

Example 3 with LibraryManager

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

the class NsiliEndpointTest method testGetDataModelMgr.

@Test
public void testGetDataModelMgr() throws Exception {
    LibraryManager dataModelMgr = nsiliEndpoint.getLibrary().get_manager(NsiliManagerType.DATA_MODEL_MGR.getSpecName(), testAccessCriteria);
    assertThat(dataModelMgr, notNullValue());
}
Also used : LibraryManager(org.codice.alliance.nsili.common.GIAS.LibraryManager) Test(org.junit.Test)

Example 4 with LibraryManager

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

the class NsiliEndpointTest method testGetProductMgr.

@Test
public void testGetProductMgr() throws Exception {
    LibraryManager productMgr = nsiliEndpoint.getLibrary().get_manager(NsiliManagerType.PRODUCT_MGR.getSpecName(), testAccessCriteria);
    assertThat(productMgr, notNullValue());
}
Also used : LibraryManager(org.codice.alliance.nsili.common.GIAS.LibraryManager) Test(org.junit.Test)

Example 5 with LibraryManager

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

the class NsiliEndpointTest method testGetCatalogMgr.

@Test
public void testGetCatalogMgr() throws Exception {
    LibraryManager catalogMgr = nsiliEndpoint.getLibrary().get_manager(NsiliManagerType.CATALOG_MGR.getSpecName(), testAccessCriteria);
    assertThat(catalogMgr, notNullValue());
}
Also used : LibraryManager(org.codice.alliance.nsili.common.GIAS.LibraryManager) Test(org.junit.Test)

Aggregations

LibraryManager (org.codice.alliance.nsili.common.GIAS.LibraryManager)10 Test (org.junit.Test)6 InvalidInputParameter (org.codice.alliance.nsili.common.UCO.InvalidInputParameter)3 AccessCriteria (org.codice.alliance.nsili.common.GIAS.AccessCriteria)2 UCO.exception_details (org.codice.alliance.nsili.common.UCO.exception_details)2 ProcessingFault (org.codice.alliance.nsili.common.UCO.ProcessingFault)1 SystemFault (org.codice.alliance.nsili.common.UCO.SystemFault)1 CatalogMgrImpl (org.codice.alliance.nsili.mockserver.impl.managers.CatalogMgrImpl)1 DataModelMgrImpl (org.codice.alliance.nsili.mockserver.impl.managers.DataModelMgrImpl)1 OrderMgrImpl (org.codice.alliance.nsili.mockserver.impl.managers.OrderMgrImpl)1 ProductMgrImpl (org.codice.alliance.nsili.mockserver.impl.managers.ProductMgrImpl)1 Object (org.omg.CORBA.Object)1