use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class AlarmSystemContainerServices method deactivateOffShoot.
@Override
public void deactivateOffShoot(Object offshootImpl) throws AcsJContainerServicesEx {
if (offshootImpl instanceof Servant) {
Servant cbServant = (Servant) offshootImpl;
try {
checkOffShootServant(cbServant);
POA rootPOA = alSysCorbaServer.getRootPOA();
if (cbServant == null || rootPOA == null) {
String msg = "deactivateOffShoot called with missing parameter.";
AcsJContainerEx ex = new AcsJContainerEx();
ex.setContextInfo(msg);
throw ex;
}
byte[] id = null;
try {
POA offshootPoa = getPOAForOffshoots(rootPOA);
id = offshootPoa.servant_to_id(cbServant);
offshootPoa.deactivate_object(id);
} catch (AcsJContainerEx e) {
throw e;
} catch (Throwable thr) {
String msg = "failed to deactivate offshoot of type '" + cbServant.getClass().getName() + "' (ID=" + String.valueOf(id) + ")";
logger.log(Level.WARNING, msg, thr);
AcsJContainerEx ex = new AcsJContainerEx(thr);
ex.setContextInfo(msg);
throw ex;
}
} catch (AcsJContainerEx ex) {
throw new AcsJContainerServicesEx(ex);
}
} else {
AcsJContainerServicesEx ex = new AcsJContainerServicesEx();
ex.setContextInfo("Not yet implemented");
throw ex;
}
}
use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class AlarmSystemContainerServices method createNotificationChannelSubscriber.
@Override
public <T> AcsEventSubscriber<T> createNotificationChannelSubscriber(String channelName, String channelNotifyServiceDomainName, Class<T> eventType) throws AcsJContainerServicesEx {
if (eventType == null || !IDLEntity.class.isAssignableFrom(eventType)) {
throw new IllegalArgumentException("With Corba-NC based pub-sub, the event must be an instance of IDLEntity.");
}
AcsEventSubscriber<T> subscriber = null;
try {
// TODO: try to get the naming service ref in a nicer way (from ORB etc)
NamingContext namingService = Helper.getNamingServiceInitial(this);
// This is dirty omitting of <T> because NCSubscriber needs something like "<U extends T & IDLEntity>"
// Note that this problem does not exist in the ContainerServicesImpl because there we instantiate via reflection.
subscriber = new NCSubscriber(channelName, channelNotifyServiceDomainName, this, namingService, this.getName(), eventType);
} catch (Throwable e) {
logger.log(AcsLogLevel.ERROR, "Unexpected error while creating new AcsEventSubscriber object", e);
AcsJContainerServicesEx ex = new AcsJContainerServicesEx(e);
throw ex;
}
// m_subscribers.put( (channelNotifyServiceDomainName == null ? "" : channelNotifyServiceDomainName) + "/" + channelName, subscriber);
return subscriber;
}
use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class AlarmSystemContainerServices method activateOffShoot.
@Override
public <T extends Servant & OffShootOperations> OffShoot activateOffShoot(T cbServant) throws AcsJContainerServicesEx {
if (cbServant == null) {
String msg = "activateOffShoot called with missing parameter.";
AcsJContainerServicesEx ex = new AcsJContainerServicesEx();
ex.setContextInfo(msg);
throw ex;
}
POA offshootPoa;
try {
offshootPoa = getPOAForOffshoots(alSysCorbaServer.getRootPOA());
} catch (Exception e) {
AcsJContainerServicesEx ex = new AcsJContainerServicesEx(e);
throw ex;
}
org.omg.CORBA.Object actObj = null;
try {
offshootPoa.activate_object(cbServant);
actObj = offshootPoa.servant_to_reference(cbServant);
// just to provoke an exc. if
actObj._hash(Integer.MAX_VALUE);
// something is wrong with our
// new object
logger.finer("offshoot of type '" + cbServant.getClass().getName() + "' activated as a CORBA object.");
} catch (Throwable thr) {
AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
ex.setContextInfo("failed to activate offshoot of type '" + cbServant.getClass().getName());
throw ex;
}
return OffShootHelper.narrow(actObj);
}
use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class DAOManager method backupCDB.
public void backupCDB() {
DAL dal = null;
WDAL wdal = null;
try {
dal = _contServ.getCDB();
} catch (AcsJContainerServicesEx e) {
return;
}
wdal = WDALHelper.narrow(dal);
if (wdal == null)
return;
String src = "Alarms";
String dst;
int i = 1;
do {
dst = src + ".bkp." + i;
i++;
} while (nodeExists(wdal, "", dst));
copyNode(wdal, src, dst);
}
use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class ACSAlarmSystemInterfaceFactory method init.
/**
* Init the static variables of the class
* This method has to be called before executing any other
* method.
*
* @param logger The logger
* @param dal The DAL to init the AS with CERN or ACS implementation
* @throws AcsJContainerServicesEx
*/
public static void init(ContainerServicesBase containerServices) throws AcsJContainerServicesEx {
if (containerServices == null) {
throw new AcsJContainerServicesEx(new Exception("Invalid null ContainerServicesBase"));
}
ACSAlarmSystemInterfaceFactory.containerServices = containerServices;
ACSAlarmSystemInterfaceFactory.logger = containerServices.getLogger();
DAL dal = containerServices.getCDB();
if (logger == null || dal == null) {
throw new IllegalArgumentException("Invalid DAL or Logger from ContainerServicesBase");
}
alarmSourceFactory = new AlarmSourceFactory(containerServices);
useACSAlarmSystem = retrieveImplementationType(dal);
if (logger != null) {
if (useACSAlarmSystem) {
logger.log(AcsLogLevel.DEBUG, "Alarm system type: ACS");
} else {
logger.log(AcsLogLevel.DEBUG, "Alarm system type: CERN");
try {
initCmwMom();
} catch (Throwable t) {
throw new AcsJContainerServicesEx(new Exception("Error initing cmw-mom", t));
}
}
}
}
Aggregations