use of org.omg.PortableServer.POAPackage.ServantAlreadyActive 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;
}
use of org.omg.PortableServer.POAPackage.ServantAlreadyActive 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;
}
use of org.omg.PortableServer.POAPackage.ServantAlreadyActive 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.ServantAlreadyActive 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.ServantAlreadyActive 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;
}
Aggregations