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;
}
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;
}
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;
}
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;
}
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());
}
Aggregations