Search in sources :

Example 11 with AcsJCORBAProblemEx

use of alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx in project ACS by ACS-Community.

the class Helper method createNotifyChannel_internal.

/**
	 * Broken out from {@link #createNotificationChannel(String, String, String)}
	 * to give tests better control about the timing when this call to the event factory is made.
	 * @throws NameAlreadyUsed if the call to NotifyFactory#create_named_channel fails with this exception.
	 * @throws AcsJCORBAProblemEx if the TAO extension throws a NameMapError or if the QoS attributes cause a UnsupportedAdmin.
	 */
protected EventChannel createNotifyChannel_internal(Property[] initial_qos, Property[] initial_admin, IntHolder channelIdHolder) throws NameAlreadyUsed, UnsupportedQoS, AcsJNarrowFailedEx, AcsJCORBAProblemEx {
    EventChannel ret = null;
    StopWatch stopwatch = new StopWatch();
    try {
        // The TAO extension of the notify factory that we use declares only the plain EventChannel type, 
        // even though it creates the TAO-extension subtype.
        org.omg.CosNotifyChannelAdmin.EventChannel eventChannelBaseType = notifyFactory.create_named_channel(initial_qos, initial_admin, channelIdHolder, channelName);
        LOG_NC_ChannelCreatedRaw_OK.log(m_logger, channelName, channelIdHolder.value, stopwatch.getLapTimeMillis());
        // re-create the client side corba stub, to get the extension subtype
        ret = gov.sandia.NotifyMonitoringExt.EventChannelHelper.narrow(eventChannelBaseType);
    } catch (BAD_PARAM ex) {
        LOG_NC_TaoExtensionsSubtypeMissing.log(m_logger, channelName, EventChannel.class.getName(), org.omg.CosNotifyChannelAdmin.EventChannelHelper.id());
        AcsJNarrowFailedEx ex2 = new AcsJNarrowFailedEx(ex);
        ex2.setNarrowType(EventChannelHelper.id());
        throw ex2;
    } catch (NameMapError ex) {
        String msg = "Got a TAO extension-specific NameMapError exception that means the TAO NC extension is not usable. Bailing out since we need the extension.";
        m_logger.log(AcsLogLevel.ERROR, msg, ex);
        AcsJCORBAProblemEx ex2 = new AcsJCORBAProblemEx(ex);
        ex2.setInfo(msg);
        throw ex2;
    } catch (UnsupportedAdmin ex) {
        AcsJCORBAProblemEx ex2 = new AcsJCORBAProblemEx(ex);
        ex2.setInfo(createUnsupportedAdminLogMessage(ex));
        throw ex2;
    }
    return ret;
}
Also used : EventChannel(gov.sandia.NotifyMonitoringExt.EventChannel) AcsJCORBAProblemEx(alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx) NameMapError(gov.sandia.NotifyMonitoringExt.NameMapError) BAD_PARAM(org.omg.CORBA.BAD_PARAM) AcsJNarrowFailedEx(alma.ACSErrTypeCORBA.wrappers.AcsJNarrowFailedEx) UnsupportedAdmin(org.omg.CosNotification.UnsupportedAdmin) StopWatch(alma.acs.util.StopWatch)

Example 12 with AcsJCORBAProblemEx

use of alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx in project ACS by ACS-Community.

the class LogLevelSelectorPanel method loggersLbl.

/**
	 * Gets the loggers and their levels.
	 * <p>
	 * This method makes remote calls and should not be called in the event thread! 
	 * 
	 * @return
	 * @throws AcsJCORBAProblemEx In case of ORB / network failure or if remote process is unresponsive or unreachable.
	 */
private LogLevelHelper[] loggersLbl() throws AcsJCORBAProblemEx {
    List<LogLevelHelper> ret = new ArrayList<LogLevelHelper>();
    try {
        // get the logger names
        final String[] logNames = logConf.get_logger_names();
        // get the log levels for each logger
        for (String logName : logNames) {
            try {
                LogLevels logLevels = logConf.get_logLevels(logName);
                ret.add(new LogLevelHelper(logName, logLevels));
            } catch (LoggerDoesNotExistEx ex) {
                logger.warning("Failed to retrieve log levels info for logger '" + logName + "'. Will skip this logger.");
            }
        }
        return ret.toArray(new LogLevelHelper[0]);
    } catch (SystemException ex) {
        AcsJCORBAProblemEx ex2 = new AcsJCORBAProblemEx(ex);
        ex2.setInfo("Failed to retrieve logger names or levels.");
        throw ex2;
    }
}
Also used : AcsJCORBAProblemEx(alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx) SystemException(org.omg.CORBA.SystemException) ArrayList(java.util.ArrayList) LoggerDoesNotExistEx(alma.Logging.LoggerDoesNotExistEx) LogLevels(alma.Logging.LoggingConfigurablePackage.LogLevels)

Example 13 with AcsJCORBAProblemEx

use of alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx in project ACS by ACS-Community.

the class BACIRemoteAccess method logACSException.

/**
	 * Logs ACSException.
	 * @param exceptionThrown
	 */
private void logACSException(Exception exceptionThrown) {
    /* all user exception is expected to be using ACS Error System */
    if (exceptionThrown instanceof DataException) {
        DataException de = (DataException) exceptionThrown;
        /*
			 * This is just to probe if we have an ACS Exception.
			 * All applications should deal with ACS Exception and we want 
			 * to issue a warning if this is not the case.
			 * In this case we get an exception and the trap will log the warning.
			 */
        if (de.get("errorTrace") != null) {
            AcsJObjectExplorerReportEx objexpEx = new AcsJObjectExplorerReportEx(exceptionThrown);
            objexpEx.log(BACILogger.getLogger());
        } else {
            AcsJObjectExplorerReportEx notAnAcsEx = new AcsJObjectExplorerReportEx(exceptionThrown);
            notAnAcsEx.setContext("Logging a User Exception that is NOT an ACS Exception");
            notAnAcsEx.log(BACILogger.getLogger());
            notifier.reportDebug("BACIRemoteAccess::logACSExcpetion", "Failed to wrap user exception into native ACS Error System exception" + " for '" + de.id() + "'.");
        }
    } else /* End if org.omg.CORBA.UserException */
    if (exceptionThrown instanceof alma.acs.exceptions.AcsJException) {
        AcsJObjectExplorerReportEx objexpEx = new AcsJObjectExplorerReportEx(exceptionThrown);
        objexpEx.log(BACILogger.getLogger());
    } else if (exceptionThrown instanceof org.omg.CORBA.SystemException) {
        org.omg.CORBA.SystemException corbaSys = (org.omg.CORBA.SystemException) exceptionThrown;
        AcsJCORBAProblemEx corbaProblemEx = new AcsJCORBAProblemEx(exceptionThrown);
        corbaProblemEx.setMinor(corbaSys.minor);
        corbaProblemEx.setCompletionStatus(corbaSys.completed.value());
        corbaProblemEx.setInfo(corbaSys.toString());
        AcsJObjectExplorerReportEx objexpEx = new AcsJObjectExplorerReportEx(corbaProblemEx);
        objexpEx.log(BACILogger.getLogger());
    } else {
        AcsJUnexpectedExceptionEx unexpectedEx = new AcsJUnexpectedExceptionEx(exceptionThrown);
        AcsJObjectExplorerReportEx objexpEx = new AcsJObjectExplorerReportEx(unexpectedEx);
        objexpEx.log(BACILogger.getLogger());
        notifier.reportDebug("BACIRemoteAccess::logACSException", "Received an unexpected exception: " + " '" + exceptionThrown.getClass().getName() + "'.");
    }
}
Also used : DataException(si.ijs.acs.objectexplorer.engine.DataException) AcsJCORBAProblemEx(alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx) AcsJException(alma.acs.exceptions.AcsJException) AcsJUnexpectedExceptionEx(alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx) AcsJObjectExplorerReportEx(alma.objexpErrType.wrappers.AcsJObjectExplorerReportEx)

Aggregations

AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)13 NameMapError (gov.sandia.NotifyMonitoringExt.NameMapError)4 BAD_PARAM (org.omg.CORBA.BAD_PARAM)4 IntHolder (org.omg.CORBA.IntHolder)4 AcsJNarrowFailedEx (alma.ACSErrTypeCORBA.wrappers.AcsJNarrowFailedEx)3 NameAlreadyUsed (gov.sandia.NotifyMonitoringExt.NameAlreadyUsed)3 AdminLimitExceeded (org.omg.CosNotifyChannelAdmin.AdminLimitExceeded)3 LogLevels (alma.Logging.LoggingConfigurablePackage.LogLevels)2 AcsJException (alma.acs.exceptions.AcsJException)2 StopWatch (alma.acs.util.StopWatch)2 EventChannel (gov.sandia.NotifyMonitoringExt.EventChannel)2 SystemException (org.omg.CORBA.SystemException)2 TIMEOUT (org.omg.CORBA.TIMEOUT)2 NameComponent (org.omg.CosNaming.NameComponent)2 AcsJCORBAReferenceNilEx (alma.ACSErrTypeCORBA.wrappers.AcsJCORBAReferenceNilEx)1 AcsJIllegalArgumentEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)1 AcsJUnexpectedExceptionEx (alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx)1 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)1 LoggerDoesNotExistEx (alma.Logging.LoggerDoesNotExistEx)1 AcsLogLevel (alma.acs.logging.AcsLogLevel)1