Search in sources :

Example 11 with SystemException

use of org.omg.CORBA.SystemException in project ACS by ACS-Community.

the class LogLevelSelectorPanel method applyChanges.

/**
	 * Apply the changes to the log levels, if any.
	 * <p>
	 * TODO: This method makes remote calls and should not be called in the event thread.
	 *       However this would require more refactoring, because it currently also accesses swing components.
	 * 
	 * @throws AcsJCORBAProblemEx In case of ORB / network failure or if remote process is unresponsive or unreachable.
	 */
private void applyChanges() {
    try {
        for (LogLevelHelper logLvl : model.getLevels()) {
            if (logLvl.modified()) {
                // see reset of modification flag in the changesApplied call below
                System.out.println("Applying new log levels to " + logLvl.getName() + ": <" + logLvl.isUsingDefault() + ", " + logLvl.getGlobalLevel() + ", " + logLvl.getLocalLevel() + ">");
                logConf.set_logLevels(logLvl.getName(), logLvl.getLogLevels());
            }
        }
        int localIndex = allLocalCB.getSelectedIndex();
        LogTypeHelper local = LogTypeHelper.values()[localIndex];
        final int localAcs = local.getAcsCoreLevel().value;
        int globalIndex = allGlobalCB.getSelectedIndex();
        LogTypeHelper global = LogTypeHelper.values()[globalIndex];
        final int globalAcs = global.getAcsCoreLevel().value;
        boolean useDefault = logConf.get_default_logLevels().useDefault;
        LogLevels toset = new LogLevels(useDefault, (short) globalAcs, (short) localAcs);
        logConf.set_default_logLevels(toset);
        model.changesApplied();
        updateMinLevels();
        applyBtn.setEnabled(false);
    } catch (SystemException ex) {
        //			AcsJCORBAProblemEx ex2 = new AcsJCORBAProblemEx(ex);
        String msg = "Failed to set log levels for '" + getName() + "' because of Corba errors. Giving up, also for other loggers of the same process.";
        logger.log(Level.WARNING, msg, ex);
        JOptionPane.showMessageDialog(null, msg + " \nCheck the logs for details.", "Error", JOptionPane.ERROR_MESSAGE);
    } catch (Exception ex) {
        //			AcsJUnexpectedExceptionEx ex2 = new AcsJUnexpectedExceptionEx(ex);
        String msg = "Failed to set log levels for '" + getName() + "'. Giving up, also for other loggers of the same process.";
        logger.log(Level.WARNING, msg, ex);
        JOptionPane.showMessageDialog(null, msg + " \nCheck the logs for details.", "Error", JOptionPane.ERROR_MESSAGE);
    }
}
Also used : SystemException(org.omg.CORBA.SystemException) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) SystemException(org.omg.CORBA.SystemException) LogLvlSelNotSupportedException(alma.acs.gui.loglevel.LogLvlSelNotSupportedException) LogLevels(alma.Logging.LoggingConfigurablePackage.LogLevels)

Example 12 with SystemException

use of org.omg.CORBA.SystemException in project ACS by ACS-Community.

the class CharacteristicModelImpl method get_characteristic_by_name.

/*********************** [ CharacteristicModel ] ***********************/
/**
	 * @see alma.ACS.CharacteristicModelOperations#get_characteristic_by_name(java.lang.String)
	 */
public Any get_characteristic_by_name(String name) throws NoSuchCharacteristic {
    try {
        String strVal = new String();
        if (prefix == "")
            strVal = dao.get_string(name);
        else
            strVal = dao.get_string(prefix + name);
        //I needed the getAny() to create a new Any, since a constructor for
        // Any (i.e: new Any() ), doesn't exist
        Any value_p = m_container.getAdvancedContainerServices().getAny();
        value_p.insert_string(strVal);
        return value_p;
    } catch (CDBFieldDoesNotExistEx fde) {
        NoSuchCharacteristic nsc = new NoSuchCharacteristic();
        nsc.characteristic_name = name;
        nsc.component_name = modelName;
        throw nsc;
    } catch (SystemException se) {
        throw se;
    } catch (WrongCDBDataTypeEx wct) {
    }
    throw new NoSuchCharacteristic();
}
Also used : SystemException(org.omg.CORBA.SystemException) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) Any(org.omg.CORBA.Any) WrongCDBDataTypeEx(alma.cdbErrType.WrongCDBDataTypeEx)

Example 13 with SystemException

use of org.omg.CORBA.SystemException in project jdk8u_jdk by JetBrains.

the class _HelloInterface_Stub method sayHelloWithTest3.

public Test3 sayHelloWithTest3(Test3 arg0) throws java.rmi.RemoteException {
    if (!Util.isLocal(this)) {
        try {
            org.omg.CORBA_2_3.portable.InputStream in = null;
            try {
                org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) _request("sayHelloWithTest3", true);
                out.write_value(arg0, Test3.class);
                in = (org.omg.CORBA_2_3.portable.InputStream) _invoke(out);
                return (Test3) in.read_value(Test3.class);
            } catch (ApplicationException ex) {
                in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
                String $_id = in.read_string();
                throw new UnexpectedException($_id);
            } catch (RemarshalException ex) {
                return sayHelloWithTest3(arg0);
            } finally {
                _releaseReply(in);
            }
        } catch (SystemException ex) {
            throw Util.mapSystemException(ex);
        }
    } else {
        ServantObject so = _servant_preinvoke("sayHelloWithTest3", HelloInterface.class);
        if (so == null) {
            return sayHelloWithTest3(arg0);
        }
        try {
            Test3 arg0Copy = (Test3) Util.copyObject(arg0, _orb());
            Test3 result = ((HelloInterface) so.servant).sayHelloWithTest3(arg0Copy);
            return (Test3) Util.copyObject(result, _orb());
        } catch (Throwable ex) {
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
            throw Util.wrapException(exCopy);
        } finally {
            _servant_postinvoke(so);
        }
    }
}
Also used : UnexpectedException(java.rmi.UnexpectedException) InputStream(org.omg.CORBA.portable.InputStream) OutputStream(org.omg.CORBA.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) ServantObject(org.omg.CORBA.portable.ServantObject)

Example 14 with SystemException

use of org.omg.CORBA.SystemException in project jdk8u_jdk by JetBrains.

the class _HelloInterface_Stub method sayHelloWithHashMap2.

public String sayHelloWithHashMap2(HashMap arg0) throws java.rmi.RemoteException {
    if (!Util.isLocal(this)) {
        try {
            org.omg.CORBA_2_3.portable.InputStream in = null;
            try {
                org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) _request("sayHelloWithHashMap2", true);
                out.write_value(arg0, HashMap.class);
                in = (org.omg.CORBA_2_3.portable.InputStream) _invoke(out);
                return (String) in.read_value(String.class);
            } catch (ApplicationException ex) {
                in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
                String $_id = in.read_string();
                throw new UnexpectedException($_id);
            } catch (RemarshalException ex) {
                return sayHelloWithHashMap2(arg0);
            } finally {
                _releaseReply(in);
            }
        } catch (SystemException ex) {
            throw Util.mapSystemException(ex);
        }
    } else {
        ServantObject so = _servant_preinvoke("sayHelloWithHashMap2", HelloInterface.class);
        if (so == null) {
            return sayHelloWithHashMap2(arg0);
        }
        try {
            HashMap arg0Copy = (HashMap) Util.copyObject(arg0, _orb());
            return ((HelloInterface) so.servant).sayHelloWithHashMap2(arg0Copy);
        } catch (Throwable ex) {
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
            throw Util.wrapException(exCopy);
        } finally {
            _servant_postinvoke(so);
        }
    }
}
Also used : UnexpectedException(java.rmi.UnexpectedException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) InputStream(org.omg.CORBA.portable.InputStream) OutputStream(org.omg.CORBA.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) ServantObject(org.omg.CORBA.portable.ServantObject)

Example 15 with SystemException

use of org.omg.CORBA.SystemException in project jdk8u_jdk by JetBrains.

the class _HelloInterface_Stub method sayHello.

public String sayHello(String arg0) throws java.rmi.RemoteException {
    if (!Util.isLocal(this)) {
        try {
            org.omg.CORBA_2_3.portable.InputStream in = null;
            try {
                org.omg.CORBA_2_3.portable.OutputStream out = (org.omg.CORBA_2_3.portable.OutputStream) _request("sayHello", true);
                out.write_value(arg0, String.class);
                in = (org.omg.CORBA_2_3.portable.InputStream) _invoke(out);
                return (String) in.read_value(String.class);
            } catch (ApplicationException ex) {
                in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
                String $_id = in.read_string();
                throw new UnexpectedException($_id);
            } catch (RemarshalException ex) {
                return sayHello(arg0);
            } finally {
                _releaseReply(in);
            }
        } catch (SystemException ex) {
            throw Util.mapSystemException(ex);
        }
    } else {
        ServantObject so = _servant_preinvoke("sayHello", HelloInterface.class);
        if (so == null) {
            return sayHello(arg0);
        }
        try {
            return ((HelloInterface) so.servant).sayHello(arg0);
        } catch (Throwable ex) {
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
            throw Util.wrapException(exCopy);
        } finally {
            _servant_postinvoke(so);
        }
    }
}
Also used : UnexpectedException(java.rmi.UnexpectedException) InputStream(org.omg.CORBA.portable.InputStream) OutputStream(org.omg.CORBA.portable.OutputStream) RemarshalException(org.omg.CORBA.portable.RemarshalException) ApplicationException(org.omg.CORBA.portable.ApplicationException) SystemException(org.omg.CORBA.SystemException) ServantObject(org.omg.CORBA.portable.ServantObject)

Aggregations

SystemException (org.omg.CORBA.SystemException)15 ApplicationException (org.omg.CORBA.portable.ApplicationException)8 InputStream (org.omg.CORBA.portable.InputStream)8 OutputStream (org.omg.CORBA.portable.OutputStream)8 RemarshalException (org.omg.CORBA.portable.RemarshalException)8 UnexpectedException (java.rmi.UnexpectedException)7 ServantObject (org.omg.CORBA.portable.ServantObject)7 LogLevels (alma.Logging.LoggingConfigurablePackage.LogLevels)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)2 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)2 InetAddress (java.net.InetAddress)2 HashMap (java.util.HashMap)2 ReentrantLock (java.util.concurrent.locks.ReentrantLock)2 NoSuchCharacteristic (alma.ACS.NoSuchCharacteristic)1 AcsJIllegalArgumentEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)1 LoggerDoesNotExistEx (alma.Logging.LoggerDoesNotExistEx)1 LogLvlSelNotSupportedException (alma.acs.gui.loglevel.LogLvlSelNotSupportedException)1 CDBFieldDoesNotExistEx (alma.cdbErrType.CDBFieldDoesNotExistEx)1 WrongCDBDataTypeEx (alma.cdbErrType.WrongCDBDataTypeEx)1