use of alma.acsErrTypeAlarmSourceFactory.wrappers.AcsJACSASFactoryNotInitedEx in project ACS by ACS-Community.
the class ACSAlarmSystemInterfaceFactory method createSource.
/**
* Create a new instance of an alarm system interface.
* @param sourceName the source name.
* @return the interface instance.
* @throws ASIException if the AlarmSystemInterface instance can not be created.
*/
public static synchronized ACSAlarmSystemInterface createSource(String sourceName) throws ACSASFactoryNotInitedEx, SourceCreationErrorEx {
if (useACSAlarmSystem == null) {
Exception e = new IllegalStateException("Factory not initialised");
throw new AcsJACSASFactoryNotInitedEx(e).toACSASFactoryNotInitedEx();
}
if (useACSAlarmSystem) {
return new ACSAlarmSystemInterfaceProxy(sourceName, logger);
} else {
if (source != null) {
return source;
}
try {
Thread t = Thread.currentThread();
ClassLoader loader = t.getContextClassLoader();
Class cl = loader.loadClass("alma.acs.alarmsystem.binding.ACSLaserSource");
Class[] classes = { String.class, Logger.class };
Constructor constructor = cl.getConstructor(classes);
// TODO: take ContainerServicesBase object received in the init method,
// and set it on ACSJMSTopicConnectionImpl.containerServices
// Of course in after the ACS 7.0 release rush, this static field communication
// must be replaced with with real calls, or at least the absence of such an object must be detected early.
source = (ACSAlarmSystemInterface) constructor.newInstance(sourceName, logger);
return source;
} catch (Throwable t) {
System.out.println("ERROR: " + t.getMessage());
t.printStackTrace();
throw new AcsJSourceCreationErrorEx(t).toSourceCreationErrorEx();
}
}
}
use of alma.acsErrTypeAlarmSourceFactory.wrappers.AcsJACSASFactoryNotInitedEx 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();
}
}
}
Aggregations