Search in sources :

Example 6 with NO_IMPLEMENT

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;
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) Destination(org.codice.alliance.nsili.common.GIAS.Destination) SecurityServiceException(ddf.security.service.SecurityServiceException) DeliveryDetails(org.codice.alliance.nsili.common.GIAS.DeliveryDetails) DeliveryManifest(org.codice.alliance.nsili.common.GIAS.DeliveryManifest) ArrayList(java.util.ArrayList) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) PackagingSpecFormatType(org.codice.alliance.nsili.common.PackagingSpecFormatType) ProductDetails(org.codice.alliance.nsili.common.GIAS.ProductDetails) PackagingSpec(org.codice.alliance.nsili.common.GIAS.PackagingSpec) ExecutionException(org.apache.shiro.subject.ExecutionException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) WrongAdapter(org.omg.PortableServer.POAPackage.WrongAdapter) PackageElement(org.codice.alliance.nsili.common.GIAS.PackageElement) BAD_OPERATION(org.omg.CORBA.BAD_OPERATION)

Example 7 with NO_IMPLEMENT

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;
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) SubtransactionAwareResource(org.omg.CosTransactions.SubtransactionAwareResource) BasicAction(com.arjuna.ats.arjuna.coordinator.BasicAction) INVALID_TRANSACTION(org.omg.CORBA.INVALID_TRANSACTION) BAD_PARAM(org.omg.CORBA.BAD_PARAM) OTSAbstractRecord(com.arjuna.ArjunaOTS.OTSAbstractRecord) AbstractRecord(com.arjuna.ats.arjuna.coordinator.AbstractRecord) UidCoordinator(com.arjuna.ArjunaOTS.UidCoordinator) RecoveryCoordinator(org.omg.CosTransactions.RecoveryCoordinator) Coordinator(org.omg.CosTransactions.Coordinator) SystemException(org.omg.CORBA.SystemException) SynchronizationUnavailable(org.omg.CosTransactions.SynchronizationUnavailable) SubtransactionsUnavailable(org.omg.CosTransactions.SubtransactionsUnavailable) Unavailable(org.omg.CosTransactions.Unavailable) Uid(com.arjuna.ats.arjuna.common.Uid) SystemException(org.omg.CORBA.SystemException) Inactive(org.omg.CosTransactions.Inactive) RecoveryCoordinator(org.omg.CosTransactions.RecoveryCoordinator) BAD_OPERATION(org.omg.CORBA.BAD_OPERATION) UNKNOWN(org.omg.CORBA.UNKNOWN) TRANSACTION_ROLLEDBACK(org.omg.CORBA.TRANSACTION_ROLLEDBACK)

Example 8 with NO_IMPLEMENT

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;
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) RecoveryCoordinator(org.omg.CosTransactions.RecoveryCoordinator) GenericRecoveryCoordinator(com.arjuna.ats.internal.jts.orbspecific.recovery.recoverycoordinators.GenericRecoveryCoordinator) SystemException(org.omg.CORBA.SystemException)

Example 9 with NO_IMPLEMENT

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();
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) POA(org.omg.PortableServer.POA) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) Any(org.omg.CORBA.Any) PropertySetImpl(alma.ACS.jbaci.PropertySetImpl) PropertySetPOATie(org.omg.CosPropertyService.PropertySetPOATie) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) MultipleExceptions(org.omg.CosPropertyService.MultipleExceptions) Property(org.omg.CosPropertyService.Property) ORB(org.omg.CORBA.ORB) WrongCDBDataTypeEx(alma.cdbErrType.WrongCDBDataTypeEx)

Example 10 with 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
    }
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) CBDescIn(alma.ACS.CBDescIn)

Aggregations

NO_IMPLEMENT (org.omg.CORBA.NO_IMPLEMENT)17 CBDescIn (alma.ACS.CBDescIn)6 SystemException (org.omg.CORBA.SystemException)5 RecoveryCoordinator (org.omg.CosTransactions.RecoveryCoordinator)4 GenericRecoveryCoordinator (com.arjuna.ats.internal.jts.orbspecific.recovery.recoverycoordinators.GenericRecoveryCoordinator)3 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)2 EventDescription (alma.acsnc.EventDescription)2 ArrayList (java.util.ArrayList)2 BAD_OPERATION (org.omg.CORBA.BAD_OPERATION)2 BAD_PARAM (org.omg.CORBA.BAD_PARAM)2 Inactive (org.omg.CosTransactions.Inactive)2 NoSuchCharacteristic (alma.ACS.NoSuchCharacteristic)1 PropertySetImpl (alma.ACS.jbaci.PropertySetImpl)1 CDBFieldDoesNotExistEx (alma.cdbErrType.CDBFieldDoesNotExistEx)1 WrongCDBDataTypeEx (alma.cdbErrType.WrongCDBDataTypeEx)1 ArjunaFactory (com.arjuna.ArjunaOTS.ArjunaFactory)1 OTSAbstractRecord (com.arjuna.ArjunaOTS.OTSAbstractRecord)1 UidCoordinator (com.arjuna.ArjunaOTS.UidCoordinator)1 Uid (com.arjuna.ats.arjuna.common.Uid)1 AbstractRecord (com.arjuna.ats.arjuna.coordinator.AbstractRecord)1