Search in sources :

Example 1 with AcsJFaultStateCreationErrorEx

use of alma.acsErrTypeAlarmSourceFactory.wrappers.AcsJFaultStateCreationErrorEx in project ACS by ACS-Community.

the class ACSAlarmSystemInterfaceFactory method createFaultState.

/** 
	   * Factory method for creating ACSFaultState instances.
	   * @return a new ACSFaultState instance.
	   *
	   */
public static synchronized ACSFaultState createFaultState() throws ACSASFactoryNotInitedEx, FaultStateCreationErrorEx {
    if (useACSAlarmSystem == null) {
        Exception e = new IllegalStateException("Factory not initialised");
        throw new AcsJACSASFactoryNotInitedEx(e).toACSASFactoryNotInitedEx();
    }
    if (useACSAlarmSystem) {
        return new ACSFaultStateImpl();
    } else {
        try {
            Thread t = Thread.currentThread();
            ClassLoader loader = t.getContextClassLoader();
            Class cl = loader.loadClass("alma.acs.alarmsystem.binding.ACSLaserFaultStateImpl");
            Class[] classes = {};
            Constructor constructor = cl.getConstructor(classes);
            return (ACSFaultState) constructor.newInstance();
        } catch (Exception e) {
            throw new AcsJFaultStateCreationErrorEx(e).toFaultStateCreationErrorEx();
        }
    }
}
Also used : AcsJFaultStateCreationErrorEx(alma.acsErrTypeAlarmSourceFactory.wrappers.AcsJFaultStateCreationErrorEx) AcsJACSASFactoryNotInitedEx(alma.acsErrTypeAlarmSourceFactory.wrappers.AcsJACSASFactoryNotInitedEx) Constructor(java.lang.reflect.Constructor)

Aggregations

AcsJACSASFactoryNotInitedEx (alma.acsErrTypeAlarmSourceFactory.wrappers.AcsJACSASFactoryNotInitedEx)1 AcsJFaultStateCreationErrorEx (alma.acsErrTypeAlarmSourceFactory.wrappers.AcsJFaultStateCreationErrorEx)1 Constructor (java.lang.reflect.Constructor)1