use of org.omg.CORBA.NO_IMPLEMENT 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;
}
use of org.omg.CORBA.NO_IMPLEMENT in project narayana by jbosstm.
the class ArjunaTransactionImple method register_resource.
/**
* Resources are only registered with the current transaction, whereas
* subtransaction aware resources are registered with their parents when the
* current transaction ends.
*/
public RecoveryCoordinator register_resource(Resource r) throws SystemException, Inactive {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource ( " + r + " ) - called for " + get_uid());
}
if (r == null)
throw new BAD_PARAM(0, CompletionStatus.COMPLETED_NO);
currentStatus = determineStatus(this);
if (currentStatus != Status.StatusActive) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource - transaction not active: " + Utility.stringStatus(currentStatus));
}
if (currentStatus == Status.StatusMarkedRollback) {
throw new TRANSACTION_ROLLEDBACK(ExceptionCodes.MARKED_ROLLEDBACK, CompletionStatus.COMPLETED_NO);
} else
throw new Inactive();
}
AbstractRecord corbaRec = null;
BasicAction registerIn = this;
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple " + get_uid() + " ::register_resource: ");
}
//
// Creation of recovery coordinator (DBI)
//
//
// Pack the params:
// [0] = Transaction* this
//
int index = 0;
Object[] params = new Object[10];
params[index++] = this;
RecoveryCoordinator recoveryCoordinator = null;
Uid recoveryCoordinatorUid = null;
try {
recoveryCoordinator = RecoveryCreator.createRecoveryCoordinator(r, params);
if (recoveryCoordinator == null)
throw new BAD_OPERATION("RecoveryCoordinator " + jtsLogger.i18NLogger.get_orbspecific_coordinator_rcnotcreated());
} catch (NO_IMPLEMENT ex) {
/*
* This is legal, and is meant to show that this ORB or
* configuration simply doesn't support crash recovery.
*/
recoveryCoordinator = null;
} catch (SystemException e) {
jtsLogger.i18NLogger.warn_orbspecific_coordinator_rccreate(get_uid(), e);
try {
rollback_only();
} catch (Inactive ex1) {
} catch (SystemException ex2) {
jtsLogger.i18NLogger.warn_orbspecific_coordinator_rbofail("ArjunaTransactionImple.register_resource", get_uid(), ex2);
throw ex2;
}
throw e;
}
if (recoveryCoordinator != null) {
//
// We got a RecoveryCoordinator, so unpack the other return values:
// [0] = RecoveryCoordinator Uid*
//
index = 0;
recoveryCoordinatorUid = (Uid) params[index++];
} else {
//
// We didn't get a RecoveryCoordinator, so we don't assume that
// the other return values have been populated.
//
recoveryCoordinatorUid = Uid.nullUid();
}
try {
SubtransactionAwareResource staResource = org.omg.CosTransactions.SubtransactionAwareResourceHelper.narrow(r);
if (staResource != null) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " - subtransaction aware resource: YES");
}
/*
* If here the narrow was ok so we have a subtran aware
* resource.
*/
Coordinator coord = null;
if (parentHandle != null) {
/*
* If we are a SubTranResource then we get registered with
* the current transaction and its parents upon completion.
* The first parameter to the record indicates whether we
* should be propagated (registered) with the parent
* transaction.
*/
coord = parentHandle.get_coordinator();
}
corbaRec = createOTSRecord(true, r, coord, recoveryCoordinatorUid);
coord = null;
staResource = null;
} else
throw new BAD_PARAM(0, CompletionStatus.COMPLETED_NO);
} catch (BAD_PARAM ex) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " - subtransaction aware resource: NO");
}
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple " + get_uid() + " ::register_resource: Simple resource - " + ex);
}
corbaRec = createOTSRecord(true, r, null, recoveryCoordinatorUid);
} catch (Unavailable e1) {
throw new Inactive();
} catch (SystemException e2) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " : catch (SystemException) - " + e2);
}
throw e2;
} catch (Exception e3) {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " : catch (...) - " + e3);
}
throw new UNKNOWN(e3.toString(), ExceptionCodes.UNKNOWN_EXCEPTION, CompletionStatus.COMPLETED_NO);
}
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " : try end");
}
if (registerIn.add(corbaRec) != AddOutcome.AR_ADDED) {
corbaRec = null;
throw new INVALID_TRANSACTION(ExceptionCodes.ADD_FAILED, CompletionStatus.COMPLETED_NO);
} else {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("ArjunaTransactionImple::register_resource for " + get_uid() + " : resource registered");
}
}
return recoveryCoordinator;
}
use of org.omg.CORBA.NO_IMPLEMENT in project narayana by jbosstm.
the class JavaIdlRCManager method makeRC.
/**
* We create a RecoveryCoordinator reference, but without (we think)
* actually making the implementation object available to the orb.
* The data needed to construct the RecoveryCoordinator is put in
* the ObjectId. If a replay_completion is received, it will be sent,
* via the locationd daemon, to the RecoveryManager.
*/
public RecoveryCoordinator makeRC(Uid RCUid, Uid tranUid, Uid processUid, boolean isServerTransaction) {
initialise();
RecoveryCoordinator rc = null;
try {
String rcObjectId = GenericRecoveryCoordinator.makeId(RCUid, tranUid, processUid, isServerTransaction);
if (ref_ReCoo != null) {
// New for IOR template
String new_ior = RecoverIOR.getIORFromString(ORBManager.getORB().orb(), ref_ReCoo, rcObjectId);
org.omg.CORBA.Object rcAsObject = ORBManager.getORB().orb().string_to_object(new_ior);
// End for IOR Template
rc = RecoveryCoordinatorHelper.narrow(rcAsObject);
if (jtsLogger.logger.isDebugEnabled()) {
jtsLogger.logger.debug("JavaIdlRCManager: Created reference for tran " + tranUid + " = " + rc);
}
} else {
if (JavaIdlRCManager._runWithoutDaemon)
throw new NO_IMPLEMENT();
else {
jtsLogger.i18NLogger.warn_orbspecific_jacorb_recoverycoordinators_JacOrbRCManager_3();
rc = null;
}
}
} catch (Exception ex) {
jtsLogger.i18NLogger.warn_orbspecific_jacorb_recoverycoordinators_JacOrbRCManager_2(ex);
}
return rc;
}
use of org.omg.CORBA.NO_IMPLEMENT in project ACS by ACS-Community.
the class CharacteristicModelImpl method get_all_characteristics.
/**
* @see alma.ACS.CharacteristicModelOperations#get_all_characteristics()
*/
public PropertySet get_all_characteristics() {
String[] allSeq;
try {
if (prefix == "")
allSeq = dao.get_string_seq("");
else
allSeq = dao.get_string_seq(prefix);
Property[] p = new Property[allSeq.length];
for (int i = 0; i < allSeq.length; i++) {
Any a = get_characteristic_by_name(allSeq[i]);
p[i] = new Property(allSeq[i], a);
}
//dangerous methods!!
ORB orb = m_container.getAdvancedContainerServices().getORB();
POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
PropertySetImpl psetImpl = new PropertySetImpl(p);
PropertySetPOATie psetTie = new PropertySetPOATie(psetImpl, rootpoa);
return psetTie._this(orb);
} catch (CDBFieldDoesNotExistEx e) {
} catch (WrongCDBDataTypeEx e) {
} catch (NoSuchCharacteristic e) {
} catch (MultipleExceptions e) {
} catch (InvalidName e) {
} catch (AdapterInactive e) {
} catch (NullPointerException e) {
System.out.println(e);
}
throw new NO_IMPLEMENT();
}
use of org.omg.CORBA.NO_IMPLEMENT in project ACS by ACS-Community.
the class PropertyPrimTest method testCreatePostponedMonitor.
public void testCreatePostponedMonitor() {
// TODO tmp
if (true)
return;
try {
CBDescIn descIn = new CBDescIn(50000, 50000, 1208);
ROpropertyLong.create_postponed_monitor(0, null, descIn);
fail("NO_IMPLEMENT exception expected");
} catch (NO_IMPLEMENT ex) {
// OK
}
}
Aggregations